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 command1 --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/click-contrib/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
Built Distribution
File details
Details for the file click-help-colors-0.9.2.tar.gz
.
File metadata
- Download URL: click-help-colors-0.9.2.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 756245e542d29226bb3bc056bfa58886f212ba2b82f4e8cf5fc884176ac96d72 |
|
MD5 | 5de47d8b377790882bb5d20e383a104d |
|
BLAKE2b-256 | a85ae38178c3fd7bb0a0f143ed5291f7f80d391431f262db5a5e16e7d8f34046 |
File details
Details for the file click_help_colors-0.9.2-py3-none-any.whl
.
File metadata
- Download URL: click_help_colors-0.9.2-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82ef028cb0a332a154fa42fd7cca2c728a019b32bcb5a26bb32367551014a16f |
|
MD5 | f2cb1393d4c974f64a562b04dca317c7 |
|
BLAKE2b-256 | c4f76e0716e92a66aa5865ec133d2c236fd9229818e4b15ee0658612a1badb78 |