| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: click-help-colors |
| 3 |
Version: 0.9.4 |
| 4 |
Summary: Colorization of help messages in Click |
| 5 |
Home-page: https://github.com/click-contrib/click-help-colors |
| 6 |
License: MIT |
| 7 |
Keywords: click |
| 8 |
License-File: LICENSE.txt |
| 9 |
Requires-Dist: click<9,>=7.0 |
| 10 |
Provides-Extra: dev |
| 11 |
Requires-Dist: mypy; extra == "dev" |
| 12 |
Requires-Dist: pytest; extra == "dev" |
| 13 |
|
| 14 |
================= |
| 15 |
click-help-colors |
| 16 |
================= |
| 17 |
|
| 18 |
|pypi| |downloads| |
| 19 |
|
| 20 |
Colorization of help messages in Click_. |
| 21 |
|
| 22 |
Usage |
| 23 |
----- |
| 24 |
|
| 25 |
.. code:: python |
| 26 |
|
| 27 |
import click |
| 28 |
from click_help_colors import HelpColorsGroup, HelpColorsCommand |
| 29 |
|
| 30 |
@click.group( |
| 31 |
cls=HelpColorsGroup, |
| 32 |
help_headers_color='yellow', |
| 33 |
help_options_color='green' |
| 34 |
) |
| 35 |
def cli(): |
| 36 |
pass |
| 37 |
|
| 38 |
@cli.command() |
| 39 |
@click.option('--count', default=1, help='Some number.') |
| 40 |
def command1(count): |
| 41 |
click.echo('command 1') |
| 42 |
|
| 43 |
@cli.command( |
| 44 |
cls=HelpColorsCommand, |
| 45 |
help_options_color='blue' |
| 46 |
) |
| 47 |
@click.option('--name', help='Some string.') |
| 48 |
def command2(name): |
| 49 |
click.echo('command 2') |
| 50 |
|
| 51 |
.. code-block:: console |
| 52 |
|
| 53 |
$ python example.py --help |
| 54 |
|
| 55 |
.. image:: https://raw.githubusercontent.com/click-contrib/click-help-colors/master/examples/screenshots/1.png |
| 56 |
|
| 57 |
.. code-block:: console |
| 58 |
|
| 59 |
$ python example.py command1 --help |
| 60 |
|
| 61 |
.. image:: https://raw.githubusercontent.com/click-contrib/click-help-colors/master/examples/screenshots/2.png |
| 62 |
|
| 63 |
.. code-block:: console |
| 64 |
|
| 65 |
$ python example.py command2 --help |
| 66 |
|
| 67 |
.. image:: https://raw.githubusercontent.com/click-contrib/click-help-colors/master/examples/screenshots/3.png |
| 68 |
|
| 69 |
.. code:: python |
| 70 |
|
| 71 |
import click |
| 72 |
from click_help_colors import HelpColorsGroup, HelpColorsCommand |
| 73 |
|
| 74 |
@click.group( |
| 75 |
cls=HelpColorsGroup, |
| 76 |
help_headers_color='yellow', |
| 77 |
help_options_color='green', |
| 78 |
help_options_custom_colors={'command3': 'red', 'command4': 'cyan'} |
| 79 |
) |
| 80 |
def cli(): |
| 81 |
pass |
| 82 |
|
| 83 |
|
| 84 |
@cli.command( |
| 85 |
cls=HelpColorsCommand, |
| 86 |
help_headers_color=None, |
| 87 |
help_options_color=None, |
| 88 |
help_options_custom_colors={'--count': 'red', '--subtract': 'green'} |
| 89 |
) |
| 90 |
@click.option('--count', default=1, help='Count help text.') |
| 91 |
@click.option('--add', default=1, help='Add help text.') |
| 92 |
@click.option('--subtract', default=1, help='Subtract help text.') |
| 93 |
def command1(count, add, subtract): |
| 94 |
"""A command""" |
| 95 |
click.echo('command 1') |
| 96 |
|
| 97 |
... |
| 98 |
|
| 99 |
.. code-block:: console |
| 100 |
|
| 101 |
$ python example_with_custom_colors.py --help |
| 102 |
|
| 103 |
.. image:: https://raw.githubusercontent.com/click-contrib/click-help-colors/master/examples/screenshots/4.png |
| 104 |
|
| 105 |
.. code-block:: console |
| 106 |
|
| 107 |
$ python example_with_custom_colors.py command1 --help |
| 108 |
|
| 109 |
.. image:: https://raw.githubusercontent.com/click-contrib/click-help-colors/master/examples/screenshots/5.png |
| 110 |
|
| 111 |
.. code:: python |
| 112 |
|
| 113 |
from click_help_colors import version_option |
| 114 |
|
| 115 |
@click.group() |
| 116 |
def cli(): |
| 117 |
pass |
| 118 |
|
| 119 |
@cli.command() |
| 120 |
@version_option( |
| 121 |
version='1.0', |
| 122 |
prog_name='example', |
| 123 |
message_color='green' |
| 124 |
) |
| 125 |
def cmd1(): |
| 126 |
pass |
| 127 |
|
| 128 |
@cli.command() |
| 129 |
@version_option( |
| 130 |
version='1.0', |
| 131 |
prog_name='example', |
| 132 |
version_color='green', |
| 133 |
prog_name_color='yellow' |
| 134 |
) |
| 135 |
def cmd2(): |
| 136 |
pass |
| 137 |
|
| 138 |
@cli.command() |
| 139 |
@version_option( |
| 140 |
version='1.0', |
| 141 |
prog_name='example', |
| 142 |
version_color='green', |
| 143 |
prog_name_color='white', |
| 144 |
message='%(prog)s %(version)s\n python=3.7', |
| 145 |
message_color='bright_black' |
| 146 |
) |
| 147 |
def cmd3(): |
| 148 |
pass |
| 149 |
|
| 150 |
.. image:: https://raw.githubusercontent.com/click-contrib/click-help-colors/master/examples/screenshots/6.png |
| 151 |
|
| 152 |
Installation |
| 153 |
------------ |
| 154 |
|
| 155 |
With ``pip``: |
| 156 |
|
| 157 |
.. code-block:: console |
| 158 |
|
| 159 |
$ pip install click-help-colors |
| 160 |
|
| 161 |
From source: |
| 162 |
|
| 163 |
.. code-block:: console |
| 164 |
|
| 165 |
$ git clone https://github.com/click-contrib/click-help-colors.git |
| 166 |
$ cd click-help-colors |
| 167 |
$ python setup.py install |
| 168 |
|
| 169 |
.. _Click: http://click.pocoo.org/ |
| 170 |
|
| 171 |
|
| 172 |
.. |pypi| image:: https://img.shields.io/pypi/v/click-help-colors |
| 173 |
:alt: PyPI |
| 174 |
|
| 175 |
.. |downloads| image:: https://img.shields.io/pypi/dm/click-help-colors |
| 176 |
:alt: PyPI - Downloads |