10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/logbook/cli/app.rb', line 10
def stats(paths, options)
return if paths.empty?
paths.select { |path| File.file?(path) }.each do |path|
name = File.basename(path)
contents = File.read(path)
if page = Logbook::Builder.build(contents)
total_duration = page.logged_time.minutes.to_i
next unless total_duration > 0
puts "#{name}: #{format_duration(total_duration)}"
if options[:per_task]
page.tasks.each do |_, task|
task_duration = task.time_logged.minutes.to_i
next unless task_duration > 0
puts " " * (name.length + 1) + " #{task.title}: #{format_duration(task_duration)}"
end
end
end
end
end
|