Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always show total time at bottom of report #357

Merged
merged 2 commits into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve Arrow 0.15.0 support after changes in `arrow.get()` behavior (#296)
- Watson now suggests correct command if users make small typo (#318)

### Changed

- Always show total time at bottom of report (#356)

### Fixed

- Stylize prompt to create new project or tag (#310).
Expand Down
23 changes: 10 additions & 13 deletions watson/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,21 +691,18 @@ def _final_print(lines):
))
_print("")

# only show total time at the bottom for a project if it is not
# an aggregate report and there is greater than 1 project
if len(projects) > 1 and not aggregated:
_print('Total: {}'.format(
style('time', '{}'.format(format_timedelta(
datetime.timedelta(seconds=report['time'])
)))
))

# if this is a report invoked from `aggregate`
# return the lines
# if this is a report invoked from `aggregate` return the lines; do not
# show total time
if aggregated:
return lines
else:
_final_print(lines)

_print('Total: {}'.format(
style('time', '{}'.format(format_timedelta(
datetime.timedelta(seconds=report['time'])
)))
))

_final_print(lines)


@cli.command()
Expand Down