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

- old
+ new

@@ -49,11 +49,14 @@ def done id if !File.directory? CLI.setup_folder return puts "tsks was not initialized yet." end - Tsks::Storage.update id + op_status = Tsks::Storage.update id + if !op_status + puts "the specified tsk do not exist." + end end desc "list", "see all active tsks, filter by context or that are done" option :done, type: :boolean option :context @@ -69,11 +72,11 @@ elsif options[:done] tsks = Tsks::Storage.select_by({status: 'done'}) elsif options[:context] tsks = Tsks::Storage.select_by({context: options[:context]}) else - tsks = Tsks::Storage.select_by({status: 'todo'}) + tsks = Tsks::Storage.select_active end if tsks.count > 0 for tsk in tsks tsk_status = Tsks::Actions.get_tsk_status tsk[:status] @@ -193,9 +196,21 @@ if !File.directory? CLI.setup_folder return puts "tsks was not initialized yet." end op_status = Tsks::Storage.delete id + if !op_status + puts "the specified tsk do not exist." + end + end + + desc "doing ID", "mark a tsk you started doing" + def doing id + if !File.directory? CLI.setup_folder + return puts "tsks was not initialized yet." + end + + op_status = Tsks::Storage.update id, {status: 'doing'} if !op_status puts "the specified tsk do not exist." end end end