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:
@click.command(
help='Command helptext',
context_settings=dict(show_default=True))
@click.option("--test", default="foobar", help="Option helptext")
def cli(test):
pass
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.
If implemented correctly (haven't looked into the code). It should also work for @click.group()
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 https://github.com/pallets/click/pull/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.
anyway a year has passed since release 7.0, do you have any plans for releasing 7.1?
Thanks.
Spent some time to dig this. It confusing that documentation promotes this feature, but it is actually not there.
The lack of a latest selection for version, or any actual releases, is a bit odd.

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 .. versionchanged:: marker and you think it should, please make a PR.
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 versionadded note.
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.
Most helpful comment
Temporary workaround: