From 7df3379d99c2ccf65ce00899c8da1623e02eb922 Mon Sep 17 00:00:00 2001 From: David Huss <dh@atoav.com> Date: Thu, 28 May 2020 08:31:48 +0200 Subject: [PATCH] Add colors to help --- bbbmon/__init__.py | 2 +- bbbmon/bbbmon.py | 7 +++++-- poetry.lock | 20 +++++++++++++++++++- pyproject.toml | 3 ++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/bbbmon/__init__.py b/bbbmon/__init__.py index 8cf13de..45ad887 100644 --- a/bbbmon/__init__.py +++ b/bbbmon/__init__.py @@ -1 +1 @@ -__version__ = '0.1.27' +__version__ = '0.1.28' diff --git a/bbbmon/bbbmon.py b/bbbmon/bbbmon.py index 2f5585e..ba93b82 100755 --- a/bbbmon/bbbmon.py +++ b/bbbmon/bbbmon.py @@ -6,6 +6,7 @@ import json import click import toml from pathlib import Path +from click_help_colors import HelpColorsGroup # Local module imports @@ -31,7 +32,7 @@ def get_version(): -class AliasedGroup(click.Group): +class AliasedGroup(HelpColorsGroup): """ Subclass of Group to allow abbreviating commands like this: Instead of `bbbmon meetings` one could type `bbbmon m` @@ -49,7 +50,9 @@ class AliasedGroup(click.Group): ctx.fail('Too many matches: %s' % ', '.join(sorted(matches))) -@click.group(context_settings=CONTEXT_SETTINGS, cls=AliasedGroup, invoke_without_command=True) +@click.group(context_settings=CONTEXT_SETTINGS, cls=AliasedGroup, invoke_without_command=True, + help_headers_color='yellow', + help_options_color='green') @click.option('--userconfig', '-u', is_flag=True, help="Use user config even if on server") @click.option('--watch', '-w', help="Run repeatedly with the given interval in seconds", type=click.IntRange(2, 2147483647, clamp=True)) @click.option('--version', '-V', is_flag=True, help="Show version") diff --git a/poetry.lock b/poetry.lock index a5b4401..33b27be 100644 --- a/poetry.lock +++ b/poetry.lock @@ -45,6 +45,20 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" version = "7.1.2" +[[package]] +category = "main" +description = "Colorization of help messages in Click" +name = "click-help-colors" +optional = false +python-versions = "*" +version = "0.8" + +[package.dependencies] +click = ">=7.0" + +[package.extras] +dev = ["pytest"] + [[package]] category = "dev" description = "Cross-platform colored terminal text." @@ -241,7 +255,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["pathlib2", "unittest2", "jaraco.itertools", "func-timeout"] [metadata] -content-hash = "a83b9881a3285865e8351a75e707e006ec523a3604788c35f40448b1c5a75e1e" +content-hash = "8ee24b117e29b83f8fad8dd042da05414fa75b30da90c66c39c5b290a88bd6d7" python-versions = "^3.5" [metadata.files] @@ -265,6 +279,10 @@ click = [ {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, ] +click-help-colors = [ + {file = "click-help-colors-0.8.tar.gz", hash = "sha256:119e5faf69cfc919c995c5962326ac8fd87f11e56a371af594e3dfd8458f4c6e"}, + {file = "click_help_colors-0.8-py3-none-any.whl", hash = "sha256:0d841a4058ec88c47f93ff6f32547a055f8e0a0273f6bd6cb3e08430f195131d"}, +] colorama = [ {file = "colorama-0.4.3-py2.py3-none-any.whl", hash = "sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff"}, {file = "colorama-0.4.3.tar.gz", hash = "sha256:e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1"}, diff --git a/pyproject.toml b/pyproject.toml index 3177b9c..a410391 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "bbbmon" -version = "0.1.27" +version = "0.1.28" description = "A small CLI utility to monitor bbb usage" authors = ["David Huss <david.huss@hfbk-hamburg.de>"] maintainers = ["David Huss <david.huss@hfbk-hamburg.de>"] @@ -24,6 +24,7 @@ python = "^3.5" requests = "^2.23.0" click = "^7.1.2" toml = "^0.10.1" +click-help-colors = "^0.8" [tool.poetry.dev-dependencies] pytest = "^5.2" -- GitLab