-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
Given the code:
#!/usr/bin/env python
import click
from datetime import date
@click.command()
@click.option('--day', help="choose the day of the week",
default=lambda: date.today().strftime("%A"), show_default=True)
def main(day):
print "Hello world! It's a wonderful {}.".format(day)
if __name__ == '__main__':
main()
We get the correct default value when running the script:
$ ./hello.py
Hello world! It's a wonderful Tuesday.
However, the help text tries to print the lambda:
$ ./hello.py --help
Usage: hello.py [OPTIONS]
Options:
--day TEXT choose the day of the week [default: <function <lambda> at
0x109c028c0>]
--help Show this message and exit.