lib/tsks/cli.rb in tsks-0.0.11 vs lib/tsks/cli.rb in tsks-0.0.12

- old
+ new

@@ -29,11 +29,11 @@ Dir.mkdir CLI.setup_folder Tsks::Storage.init end - desc "add TSK", "add a new tsk (Use --context to specify one e.g. Work)" + desc "add TSK", "add a new tsk (Use --context to specify one e.g. --context=work)" option :context def add tsk if !File.directory? CLI.setup_folder return puts "tsks was not initialized yet." end @@ -43,11 +43,11 @@ else Tsks::Storage.insert tsk end end - desc "done ID", "mark a tsk you have already done" + desc "done ID", "mark a tsk you have done" def done id if !File.directory? CLI.setup_folder return puts "tsks was not initialized yet." end @@ -57,10 +57,11 @@ end end desc "list", "see all active tsks, filter by context or that are done" option :done, type: :boolean + option :all, type: :boolean option :context def list if !File.directory? CLI.setup_folder return puts "tsks was not initialized yet." end @@ -71,9 +72,11 @@ tsks = Tsks::Storage.select_by({status: 'done', context: options[:context]}) elsif options[:done] tsks = Tsks::Storage.select_by({status: 'done'}) elsif options[:context] tsks = Tsks::Storage.select_by({context: options[:context]}) + elsif options[:all] + tsks = Tsks::Storage.select_all else tsks = Tsks::Storage.select_active end if tsks.count > 0