Skip to content

Commit 3815a21

Browse files
authored
Merge pull request #1 from dechimp/t_out_tweak
T out tweak
2 parents eee2a39 + 93631bf commit 3815a21

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/timetrap/cli.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ def out
330330
if Config['auto_checkout']
331331
stopped = Timer.stop_all(args['-a']).each do |checked_out_of|
332332
note = Timer.last_checkout.note
333-
warn "Checked out of entry #{note.inspect} in sheet #{checked_out_of.sheet.inspect}."
333+
entry = note_blank?(note) ? Timer.last_checkout.id : note.inspect
334+
warn "Checked out of entry #{entry} in sheet #{checked_out_of.sheet.inspect}."
334335
end
335336
if stopped.empty?
336337
warn "No running entries to stop."
@@ -339,7 +340,8 @@ def out
339340
sheet = sheet_name_from_string(unused_args)
340341
if Timer.stop sheet, args['-a']
341342
note = Timer.last_checkout.note
342-
warn "Checked out of entry #{note.inspect} in sheet #{sheet.inspect}."
343+
entry = note_blank?(note) ? Timer.last_checkout.id : note.inspect
344+
warn "Checked out of entry #{entry} in sheet #{sheet.inspect}."
343345
else
344346
warn "No running entry on sheet #{sheet.inspect}."
345347
end
@@ -486,6 +488,10 @@ def month
486488

487489
private
488490

491+
def note_blank?(note)
492+
note.inspect.to_s.gsub('"', '').strip.size.zero?
493+
end
494+
489495
def unused_args
490496
args.unused.join(' ')
491497
end

0 commit comments

Comments
 (0)