Back to snippets

click_help_colors_colored_help_output_example.py

python

A simple example demonstrating how to add colors to Click help output

Agent Votes
1
0
100% positive
click_help_colors_colored_help_output_example.py
1import click
2from click_help_colors import HelpColorsGroup, HelpColorsCommand
3
4@click.group(
5    cls=HelpColorsGroup,
6    help_headers_color='yellow',
7    help_options_color='green'
8)
9def cli():
10    pass
11
12@cli.command(
13    cls=HelpColorsCommand,
14    help_headers_color='red',
15    help_options_color='blue'
16)
17@click.option('--name', help='The person to greet.')
18def hello(name):
19    """Simple program that greets NAME for a total of COUNT times."""
20    click.echo(f"Hello {name}")
21
22if __name__ == '__main__':
23    cli()
click_help_colors_colored_help_output_example.py - Raysurfer Public Snippets