Skip to content

Commit 79db77f

Browse files
madtiboederag
authored andcommitted
add total duration in 'hamster list' command (#380)
* add total duration in 'hamster list' command * use stuff.format_duration for totals
1 parent 50bbe8c commit 79db77f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/hamster-cli

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,14 @@ class HamsterClient(object):
332332
print("-" * min(row_width, 80))
333333

334334
cats = []
335+
total_duration = dt.timedelta()
335336
for cat, duration in sorted(by_cat.items(), key=lambda x: x[1], reverse=True):
336-
cats.append("%s: %s" % (cat, "%.1fh" % (stuff.duration_minutes(duration) / 60.0)))
337+
cats.append("{}: {}".format(cat, stuff.format_duration(duration)))
338+
total_duration += duration
337339

338340
for line in word_wrap(", ".join(cats), 80):
339341
print(line)
342+
print("Total: ", stuff.format_duration(total_duration))
340343

341344
print()
342345

0 commit comments

Comments
 (0)