Colorization of help messages in Click
Project description
Colorization of help messages in Click.
Usage
import click
from click_help_colors import HelpColorsGroup, HelpColorsCommand
@click.group(
cls=HelpColorsGroup,
help_headers_color='yellow',
help_options_color='green'
)
def cli():
pass
@cli.command()
@click.option('--count', default=1, help='Some number.')
def command1(count):
click.echo('command 1')
@cli.command(
cls=HelpColorsCommand,
help_options_color='blue'
)
@click.option('--name', help='Some string.')
def command2(name):
click.echo('command 2')
$ python example.py --help
$ python example.py command1 --help
$ python example.py command2 --help
import click
from click_help_colors import HelpColorsGroup, HelpColorsCommand
@click.group(
cls=HelpColorsGroup,
help_headers_color='yellow',
help_options_color='green',
help_options_custom_colors={'command3': 'red', 'command4': 'cyan'}
)
def cli():
pass
@cli.command(
cls=HelpColorsCommand,
help_headers_color=None,
help_options_color=None,
help_options_custom_colors={'--count': 'red', '--subtract': 'green'}
)
@click.option('--count', default=1, help='Count help text.')
@click.option('--add', default=1, help='Add help text.')
@click.option('--subtract', default=1, help='Subtract help text.')
def command1(count, add, subtract):
"""A command"""
click.echo('command 1')
...
$ python example_with_custom_colors.py --help
$ python example_with_custom_colors.py --help
from click_help_colors import version_option
@click.group()
def cli():
pass
@cli.command()
@version_option(
version='1.0',
prog_name='example',
message_color='green'
)
def cmd1():
pass
@cli.command()
@version_option(
version='1.0',
prog_name='example',
version_color='green',
prog_name_color='yellow'
)
def cmd2():
pass
@cli.command()
@version_option(
version='1.0',
prog_name='example',
version_color='green',
prog_name_color='white',
message='%(prog)s %(version)s\n python=3.7',
message_color='bright_black'
)
def cmd3():
pass
Installation
With pip:
$ pip install click-help-colors
From source:
$ git clone https://github.com/r-m-n/click-help-colors.git
$ cd click-help-colors
$ python setup.py install
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
click-help-colors-0.8.tar.gz
(7.0 kB
view details)
Built Distribution
File details
Details for the file click-help-colors-0.8.tar.gz
.
File metadata
- Download URL: click-help-colors-0.8.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 119e5faf69cfc919c995c5962326ac8fd87f11e56a371af594e3dfd8458f4c6e |
|
MD5 | e059755eaa2a60d7243c4f7fe49ebefb |
|
BLAKE2b-256 | cc3f6d6f3edb803eb58cd619a19f3af073f9e1b80529c73e8b02b8cc12e0ee3c |
File details
Details for the file click_help_colors-0.8-py3-none-any.whl
.
File metadata
- Download URL: click_help_colors-0.8-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d841a4058ec88c47f93ff6f32547a055f8e0a0273f6bd6cb3e08430f195131d |
|
MD5 | 1148a862b304b8c74bee9693cb9ead21 |
|
BLAKE2b-256 | b15710d5b653c2fb9a529459163126623b0d47c29653c95e4b8f0ee4bbc0cb5d |