summaryrefslogtreecommitdiffstats
path: root/lib/hcl.rb
diff options
context:
space:
mode:
authorZack Hobson2009-07-19 13:20:37 -0700
committerZack Hobson2009-07-19 13:20:37 -0700
commit7867896534da18b77f7304232f8db06ed11d583d (patch)
treefe52ab6a404b426889ed581bf63e4f2aabf10194 /lib/hcl.rb
parent36510ce224ac6f1594d6fa21977a2f62f5f41e4e (diff)
downloadhcl-7867896534da18b77f7304232f8db06ed11d583d.tar.bz2
use chronic for date parsing, started timer implementation
Diffstat (limited to 'lib/hcl.rb')
-rw-r--r--lib/hcl.rb21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/hcl.rb b/lib/hcl.rb
index 950af8b..fe86443 100644
--- a/lib/hcl.rb
+++ b/lib/hcl.rb
@@ -38,9 +38,10 @@ class HCl
Usage:
hcl show [date]
- hcl add <project> <task> <duration> [msg]
+ hcl tasks
+ hcl add <task> <duration> [msg]
hcl rm [entry_id]
- hcl start <project> <task> [msg]
+ hcl start <task> [msg]
hcl stop [msg]
Examples:
@@ -57,6 +58,19 @@ class HCl
self
end
+ def tasks
+ Task.all.each do |task|
+ # TODO more information and formatting options
+ puts "#{task.id}\t#{task}"
+ end
+ end
+
+ def start *args
+ task = Task.find args.shift
+ puts "Starting timer for #{task}"
+ puts task.start(*args)
+ end
+
def show *args
date = args.empty? ? nil : Chronic.parse(args.join(' '))
total_hours = 0.0
@@ -69,12 +83,11 @@ class HCl
puts "\t#{total_hours}\ttotal"
end
- def not_implemented
+ def not_implemented *args
puts "not yet implemented"
end
# TODO implement the following commands
- alias start not_implemented
alias stop not_implemented
alias add not_implemented
alias rm not_implemented