-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
I made this example program:
import click
@click.group()
@click.option('--debug/--no-debug')
def cli(debug):
click.echo('Debug mode is %s' % ('on' if debug else 'off'))
@cli.command()
@click.option('--username')
def greet(username):
click.echo('Hello %s!' % username)
if __name__ == '__main__':
cli(auto_envvar_prefix='GREETER')
auto_envvar_prefix
only works for GREETER_DEBUG. Setting GREETER_USERNAME has no effect
Expected result:
$ export GREETER_DEBUG="false"
$ export GREETER_USERNAME="John"
$ python greet.py greet
Debug mode is off
Hello John!
Actual result:
$ export GREETER_DEBUG="false"
$ export GREETER_USERNAME="John"
$ python greet.py greet
Debug mode is off
Hello None!
For now, I am setting envvar
on my options, but there are a lot of them
dmitrytokarev