Skip to content
Myr

Updated complex example to use context defaults

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 7d776de · Browse files · 2 files+5 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+5 added−6 removed

  • other:+5 added−6 removed

2 files+5 added−6 removed

modified:examples/complex/complex/cli.py+4 added-5 removed
1 unmodified line
2import sys3import click456CONTEXT_DEFAULTS = dict(auto_envvar_prefix='COMPLEX')789class Context(object):1011 def __init__(self):12 self.verbose = False
36 unmodified lines
49 return50 return mod.cli515250@click.command(cls=ComplexCLI)53@click.command(cls=ComplexCLI, context_defaults=CONTEXT_DEFAULTS)54@click.option('--home', type=click.Path(exists=True, file_okay=False,55 resolve_path=True),56 help='Changes the folder to operate on.')57@click.option('-v', '--verbose', is_flag=True,
3 unmodified lines
61 """A complex command line interface."""62 ctx.verbose = verbose63 if home is not None:64 ctx.home = home626364def main():65 cli(auto_envvar_prefix='COMPLEX')
modified:examples/complex/setup.py+1 added-1 removed
8 unmodified lines
9 'Click',10 ],11 entry_points='''12 [console_scripts]13 complex=complex.cli:main13 complex=complex.cli:cli14 ''',15)