lib/timetrap/cli.rb in timetrap-1.9.0 vs lib/timetrap/cli.rb in timetrap-1.10.0

- old
+ new

@@ -17,10 +17,11 @@ * archive - Move entries to a hidden sheet (by default named '_[SHEET]') so they're out of the way. usage: t archive [--start DATE] [--end DATE] [SHEET] -s, --start <date:qs> Include entries that start on this date or later -e, --end <date:qs> Include entries that start on this date or earlier + -g, --grep <regexp> Include entries where the note matches this regexp. * backend - Open an sqlite shell to the database. usage: t backend * configure - Write out a YAML config file. Print path to config file. The @@ -52,10 +53,11 @@ -f, --format <format> The output format. Valid built-in formats are ical, csv, json, ids, factor, and text (default). Documentation on defining custom formats can be found in the README included in this distribution. + -g, --grep <regexp> Include entries where the note matches this regexp. * edit - Alter an entry's note, start, or end time. Defaults to the active entry. Defaults to the last entry to be checked out of if no entry is active. usage: t edit [--id ID] [--start TIME] [--end TIME] [--append] [NOTES] -i, --id <id:i> Alter entry with id <id> instead of the running entry @@ -191,11 +193,11 @@ end def archive ee = selected_entries if ask_user "Archive #{ee.count} entries? " - ee.all.each do |e| + ee.each do |e| next unless e.end e.update :sheet => "_#{e.sheet}" end else warn "archive aborted!" @@ -275,11 +277,11 @@ entry = Entry[args['-i']] warn "Resuming entry with id #{args['-i'].inspect} (#{entry.note})" entry when Timer.last_checkout last = Timer.last_checkout - warn "Resuming last enrty you checked out of (#{last.note})" + warn "Resuming last entry you checked out of (#{last.note})" last end unless entry warn "Can't find entry" @@ -332,10 +334,10 @@ warn ["can't find #{victim} to kill", 'sheets:', *sheets].join("\n") end end def display - entries = selected_entries.order(:start).all + entries = selected_entries if entries == [] warn "No entries were selected to display." else puts format_entries(entries) end