🌈 Extra colorization and configuration loading for Click.
GPL-2.0 License
It should be easy to write a good CLI in Python. Click makes it so. But there is still hundrends of tweaks to implement by yourself to have a user-friendly CLI.
Click Extra is a ready-to-use wrapper around Click to make your CLI look good and behave well. It is a drop-in replacement with good defaults that saves lots of boilerplate code and frustration by making all parts working together.
It also comes with workarounds and patches that have not reached upstream yet (or are unlikely to).
It transforms this vanilla click
CLI:
Into this:
To undestrand how we ended up with the result above, go read the tutorial.
TOML
YAML
JSON
, with inline and block comments (Python-style #
and Javascript-style //
)INI
, with extended interpolation, multi-level sections and non-native types (list
, set
, …)XML
CLI
> Configuration
> Environment
> Defaults
precedence
--show-params
option to debug parameters defaults, values, environment variables and provenanceshow_envvar
option to display all environment variables in help screens-h
/--help
option names (see rant on other inconsistencies)--color
/--no-color
option flag--telemetry
/--no-telemetry
flag to opt-in/out of tracking codeNO_COLOR
from no-color.org
DO_NOT_TRACK
from consoledonottrack.com
--version
option--verbosity
option and logs--time
/--no-time
flag to measure duration of command executionshow_choices
to activate selection of choices on user input prompts.. click:example::
and .. click:run::
Sphinx directives to document CLI source code and their executionDid you mean <subcommand>?
)Check these projects to get real-life examples of click-extra
usage:
Feel free to send a PR to add your project in this list if you are relying on Click Extra in any way.
Development guidelines
are the same as
parent project mpm
, from
which click-extra
originated.