lib/timetrap/cli.rb in timetrap-1.7.4 vs lib/timetrap/cli.rb in timetrap-1.7.5
- old
+ new
@@ -304,10 +304,11 @@
m
end
end
end.sort_by{|sheet| sheet[:name].downcase}
width = sheets.sort_by{|h|h[:name].length }.last[:name].length + 4
+ width = 10 if width < 10
puts " %-#{width}s%-12s%-12s%s" % ["Timesheet", "Running", "Today", "Total Time"]
sheets.each do |sheet|
star = sheet[:name] == Timer.current_sheet ? '*' : ' '
puts "#{star}%-#{width}s%-12s%-12s%s" % [
sheet[:running],
@@ -320,12 +321,12 @@
def now
if !Timer.running?
puts "*#{Timer.current_sheet}: not running"
end
Timer.running_entries.each do |entry|
- current = entry[:sheet] == Timer.current_sheet
+ current = entry.sheet == Timer.current_sheet
out = current ? '*' : ' '
- out << "#{entry[:sheet]}: #{format_duration(entry.duration)}".gsub(/ /, ' ')
+ out << "#{entry.sheet}: #{format_duration(entry.duration)}".gsub(/ /, ' ')
out << " (#{entry.note})" if entry.note =~ /.+/
puts out
end
end