I have recently found the click library (http://click.pocoo.org/6/) and I love it.
I am trying to figure out if it is possible to create an alias for the --help
option which shortcuts to the help. So, for example:
app.py --help
gives the help for the main app and
app.py sub --help
will give the help for the sub. I want to be able to use -h as well. If I were creating the option, it may look something like:
@click.option('-h', '--help')
but the --help
option is built in. Is there a way to extend that option or create an alias for it?
Python click option namesClick derives the name of the option from the long name, if both are used. In the example, we create an option with both short and long names. The name of the variable passed to the function is string , derived from the longer option name. We run the program using both option names.
Well, I found it:
https://click.palletsprojects.com/en/7.x/documentation/#help-parameter-customization
@click.command(context_settings=dict(help_option_names=["-h", "--help"]))
def cli():
pass
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With