From 873325ebce6d0451263d115a8f02f40e0a6fbd40 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 27 Jan 2018 00:31:57 +0100 Subject: Add date argument to `log` command Adds an optional date argument to the `log` command that can be specified just before the task alias. Some examples from @skoppelmanCC: hcl log yesterday @documentation +2 Ran spellcheck hcl log 3 days ago @wireframes +3.5 hcl log last friday @admin +1 filed timesheets Commands#log: Copy over the contents of `Commands#start` and replace `task.start` with `task.add`. This allows us to log the time without actually starting a timer (and thus having to subsequently stop that timer). command_test.rb(#test_start): Update expected method call arguments with `spent_at`. Now that we're passing in `spent_at`, the expected arguments should include it. command_test.rb(#test_log_failure): Delete this test because I've rewritten the `Commands#log` method to no longer use timers. utility_test.rb: Add tests for `#get_date` Fixes #83. --- lib/hcl/app.rb | 2 +- lib/hcl/commands.rb | 13 ++++++++++--- lib/hcl/task.rb | 3 ++- lib/hcl/utility.rb | 10 ++++++++++ test/command_test.rb | 5 ----- test/utility_test.rb | 8 ++++++++ 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/lib/hcl/app.rb b/lib/hcl/app.rb index 4f2530b..321b3d5 100644 --- a/lib/hcl/app.rb +++ b/lib/hcl/app.rb @@ -113,7 +113,7 @@ Commands: hcl stop [] # log a task and time without leaving a timer running - hcl log @ [+