lib/timetrap/cli.rb in timetrap-1.8.13 vs lib/timetrap/cli.rb in timetrap-1.8.14
- old
+ new
@@ -95,10 +95,13 @@
usage: t sheet [TIMESHEET]
* today - Shortcut for display with start date as the current day
usage: t today [--ids] [--format FMT] [SHEET | all]
+ * yesterday - Shortcut for display with start and end dates as the day before the current day
+ usage: t yesterday [--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.
@@ -393,10 +396,17 @@
def today
args['-s'] = Date.today.to_s
display
end
+ def yesterday
+ yesterday = (Date.today - 1).to_s
+ args['-s'] = yesterday
+ args['-e'] = yesterday
+ 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
end
@@ -428,9 +438,10 @@
return true if args['-y']
$stderr.print question
$stdin.gets =~ /\Aye?s?\Z/i
end
+ extend Helpers::AutoLoad
def format_entries(entries)
load_formatter(args['-f'] || Config['default_formatter']).new(Array(entries)).output
end
end