lib/timetrap/cli.rb in timetrap-1.8.6 vs lib/timetrap/cli.rb in timetrap-1.8.7
- old
+ new
@@ -90,10 +90,13 @@
* sheet - Switch to a timesheet creating it if necessary. When no sheet is
specified list all sheets. The special sheetname '-' will switch to the
last active sheet.
usage: t sheet [TIMESHEET]
+ * today - Shortcut for display with start date as the current day
+ usage: t today [--ids] [--format FMT] [SHEET | all]
+
* week - Shortcut for display with start date set to monday of this week.
usage: t week [--ids] [--end DATE] [--format FMT] [SHEET | all]
* month - Shortcut for display with start date set to the beginning of either
this month or a specified month.
@@ -356,18 +359,23 @@
end
end
def now
if !Timer.running?
- puts "*#{Timer.current_sheet}: not running"
+ warn "*#{Timer.current_sheet}: not running"
end
Timer.running_entries.each do |entry|
current = entry.sheet == Timer.current_sheet
out = current ? '*' : ' '
out << "#{entry.sheet}: #{format_duration(entry.duration)}".gsub(/ /, ' ')
out << " (#{entry.note})" if entry.note =~ /.+/
puts out
end
+ end
+
+ def today
+ args['-s'] = Date.today.to_s
+ display
end
def week
args['-s'] = Date.today.wday == 1 ? Date.today.to_s : Date.parse(Chronic.parse(%q(last monday)).to_s).to_s
display