Type and default input value of a Click.option in --help option
<p>How can I show the default input value in @Click.option in --help option of a program.</p>

<p>Thank you.</p>

<p>Pass <code>show_default=True</code> in the <code>click.option</code> decorator when defining an option. This will display default value in the help when the program is called with <code>--help</code> option.
For example -</p>

<pre><code>#hello.py
import click

@click.command()
@click.option('--count', default=1, help='Number of greetings.', show_default=True)
@click.option('--name', prompt='Your name',
              help='The person to greet.')
def hello(count, name):
    """&lt;insert text that you want to display in help screen&gt; e.g: Simple program that greets NAME for a total of COUNT times."""
    for x in range(count):
        click.echo('Hello %s!' % name)

if __name__ == '__main__':
    hello()
</code></pre>

<p>Now you can see the help screen generated by running <code>python hello.py --help</code> as</p>

<pre><code>$ python hello.py --help
Usage: hello.py [OPTIONS]

  &lt;insert text that you want to display in help screen&gt; e.g: Simple program that greets NAME for a total of COUNT times.

Options:
  --count INTEGER  Number of greetings.  [default: 1]
  --name TEXT      The person to greet.
  --help           Show this message and exit.
</code></pre>

<p>Hence you can see that the default value of the <code>count</code> option is displayed in the help text of the program. (Reference : <a href="https://github.com/pallets/click/issues/243" rel="nofollow">https://github.com/pallets/click/issues/243</a>)</p>

python python-click