8000 Allow to force enable/disable colored output by sienkiewiczkm · Pull Request #350 · jazzband/Watson · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow to force enable/disable colored output #350

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

Merged
merged 1 commit into from
Jun 24, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Log output order can now be controlled via the `--reverse/--no-reverse` flag
and the `reverse_log` configuration option (#369)
- Add `--at` flag to the `start` and `restart` commands (#364).
- Add `--color` and `--no-color` flags to force output to be colored or not
respectively (#350).

### Changed

Expand Down
7 changes: 6 additions & 1 deletion watson/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ def wrapper(*args, **kwargs):

@click.group(cls=DYMGroup)
@click.version_option(version=_watson.__version__, prog_name='Watson')
@click.option('--color/--no-color', 'color', default=None,
help="(Don't) color output.")
@click.pass_context
def cli(ctx):
def cli(ctx, color):
"""
Watson is a tool aimed at helping you monitoring your time.

Expand All @@ -137,6 +139,9 @@ def cli(ctx):
when you're done with the `stop` command.
"""

if color is not None:
ctx.color = True if color else False

# This is the main command group, needed by click in order
# to handle the subcommands
ctx.obj = create_watson()
Expand Down
0