-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
The context_settings / Context object allows for global setting of some option/command variables. For example, to show the default for all options and setting an auto-envvar-prefix, one can do this via context_settings
:
@click.command(context_settings=dict(show_default=True, auto_envvar_prefix="MYAPP"))
@click.option("--host", default="127.0.0.1")
@click.option("--port", default="1234")
Now, to also show the environment variable for each option in the --help
output, it's required to add show_envvar=True
for each option
:
@click.option("--host", default="127.0.0.1", show_envvar=True)
@click.option("--port", default="1234", show_envvar=True)
I'd like to have this available as global setting as well, ie., I wish this would work:
@click.command(context_settings=dict(show_default=True, auto_envvar_prefix="MYAPP", show_envvar=True))
@click.option("--host", default="127.0.0.1")
@click.option("--port", default="1234")
Metadata
Metadata
Assignees
Labels
No labels