lib/timetrap/cli.rb in timetrap-1.5.1 vs lib/timetrap/cli.rb in timetrap-1.5.2

- old
+ new

@@ -28,11 +28,11 @@ Currently supported options are: round_in_seconds: The duration of time to use for rounding with the -r flag database_file: The file path of the sqlite database append_notes_delimiter: delimiter used when appending notes via - t edit --append`` + t edit --append * display - Display the current timesheet or a specific. Pass `all' as SHEET to display all sheets. usage: t display [--ids] [--start DATE] [--end DATE] [--format FMT] [SHEET | all] -v, --ids Print database ids (for use with edit) @@ -47,10 +47,11 @@ -s, --start <time:qs> Change the start time to <time> -e, --end <time:qs> Change the end time to <time> -z, --append Append to the current note instead of replacing it the delimiter between appended notes is configurable (see configure) + -m, --move <sheet> Move to another sheet * format - Deprecated: alias for display. * in - Start the timer for the current timesheet. usage: t in [--at TIME] [NOTES] @@ -143,9 +144,19 @@ def edit entry = args['-i'] ? Entry[args['-i']] : Timetrap.active_entry say "can't find entry" && return unless entry entry.update :start => args['-s'] if args['-s'] =~ /.+/ entry.update :end => args['-e'] if args['-e'] =~ /.+/ + + # update sheet + if args['-m'] =~ /.+/ + if entry == Timetrap.active_entry + Timetrap.current_sheet = args['-m'] + end + entry.update :sheet => args['-m'] + end + + # update notes if unused_args =~ /.+/ note = unused_args if args['-z'] note = [entry.note, note].join(Config['append_notes_delimiter']) end