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
I made this example program:
auto_envvar_prefixonly works for GREETER_DEBUG. Setting GREETER_USERNAME has no effectExpected result:
Actual result:
For now, I am setting
envvaron my options, but there are a lot of them