New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow showing default values globally. #1018
Comments
If implemented correctly (haven't looked into the code). It should also work for |
Temporary workaround: import functools
import click
# Use this instead of click.option
click_option = functools.partial(click.option, show_default=True)
@click.command()
@click_option('--name', default='Luke')
def say_hi(name):
print(name)
if __name__ == '__main__':
say_hi() |
Thanks @lukeyeager for the nice idea. Is this enhancement aligns with the package's developers agenda? |
This seems to be fixed in #1225 . |
The merged #1225 is not yet part of version 7.0, is that right? When is it planned to be released? |
It should be in the 7.x branch. https://github.com/pallets/click/tree/7.x Not released on PyPi yet, but you can checkout the 7.x branch and install it with the setup.py if you need this change. |
we have a lot of cli commands and a huge more params for them and going to show default, so we very appreciate for releasing this feature. |
Spent some time to dig this. It confusing that documentation promotes this feature, but it is actually not there. |
Just like git, "master" contains the latest development code, and "7.x" contains the latest 7.x branch code. I'm not sure what's odd about that. If something doesn't have a |
http://www.attrs.org/en/stable/ I may have incorrectly referred to lacking 'latest'. So I think the click 'master' is what others often refer to in this context as 'latest'. They also then have 'stable' which... I think is the most recent release? Then they have the actual releases rather than just development branches. If click offered 7.0 rather than just 7.x docs then people running 7.0 could see the docs for their actual version they are running rather than a preview of features they do not yet have access to via released versions on PyPI. |
Though yes, this change does also seem to have been missing the |
But this change did not added to any version yet. Latest version is 7.0 and it lacks of this feature. |
@pohmelie, correct. So I set the version added to 7.1 in the PR. I think some projects have you put a marker in and then they have a tool that autofills the proper version when making a release. My quick look around Click didn't show that. But, if I missed it, whoever reviews the PR will hopefully catch it and teach me. |
Feature request, as in #646, we already had a discussion how to easily show default values for options. As
context_settings
is already used to configure global settings anyway, the idea would be to allow the following:Which should enable
show_default
for all options and give the following help text:$ cli --help Usage: cli [OPTIONS] Command helptext Options: --test TEXT Option helptext. Default: 'foobar' --help Show this message and exit.
The text was updated successfully, but these errors were encountered: