-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
Fix CLI output spacing if a frame has not tags #179
Fix CLI output spacing if a frame has not tags #179
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And please rebase on master.
watson/cli.py
Outdated
delta=format_timedelta(frame.stop - frame.start), | ||
project=style('project', | ||
'{:>{}}'.format(frame.project, longest_project)), | ||
pad=longest_project, | ||
tags_spacer=" " if frame.tags else "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is much simpler:
lines.append("\n".join(
"\t{id} {start} to {stop} {delta:>11} {project}{tags}".format(
delta=format_timedelta(frame.stop - frame.start),
project=style('project',
'{:>{}}'.format(frame.project, longest_project)),
pad=longest_project,
tags=(" " if frame.tags else "") + style('tags', frame.tags),
....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine by me 👍
watson/cli.py
Outdated
delta=format_timedelta(stop - start) if stop else '-', | ||
project=style('project', project), | ||
tags_spacer=" " if tags else "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise:
click.echo(
"Edited frame for project {project}{tags}, from {start} "
"to {stop} ({delta})".format(
delta=format_timedelta(stop - start) if stop else '-',
project=style('project', project),
tags=(" " if tags else "") + style('tags', tags),
...
watson/cli.py
Outdated
project=style('project', frame.project), | ||
tags_spacer=" " if tags else "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And lastly:
click.confirm(
"You are about to remove frame {project}{tags} from "
"{start} to {stop}, continue?".format(
project=style('project', frame.project),
tags=(" " if frame.tags else "") + style('tags', frame.tags),
...
Also respect 79 char line limit and use double quotes
903e75f
to
f355a4d
Compare
Rebased onto Master and updated as suggested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now.
watson/cli.py
Outdated
@@ -826,9 +829,10 @@ def remove(watson, id, force): | |||
|
|||
if not force: | |||
click.confirm( | |||
"You are about to remove frame " | |||
"{project} {tags} from {start} to {stop}, continue?".format( | |||
"You are about to remove frame {project}{tags_spacer}{tags} from " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one space too many in front of {project}
.
Thanks @MinchinWeb ! |
If a frame has no tags, sometimes the CLI output formating will output spaces that aren't needed. This fixes that.
Broken off of #176.