diff options
author | Brett Bethke <bbethke@airware.com> | 2015-12-21 14:02:16 -0800 |
---|---|---|
committer | Brett Bethke <bbethke@airware.com> | 2015-12-21 14:17:10 -0800 |
commit | 35c6cc79d831c7c63c8787a96b0835df892c0011 (patch) | |
tree | 636d19bf896f54db2a8c5d4908139074b107600d /examples | |
parent | e27493b066e2bb8f9a3533260049faf6083c5ac8 (diff) | |
download | click-35c6cc79d831c7c63c8787a96b0835df892c0011.tar.gz |
Use already-parsed values of aruments to see whether they should be completed.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/bashcompletion/bashcompletion.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/bashcompletion/bashcompletion.py b/examples/bashcompletion/bashcompletion.py index aa64660..8121105 100644 --- a/examples/bashcompletion/bashcompletion.py +++ b/examples/bashcompletion/bashcompletion.py @@ -6,9 +6,12 @@ def cli(): pass @cli.command() -@click.argument("name", type=click.STRING, autocompletion=["John", "Simon", "Doe"]) -def cmd1(name): - click.echo('Name: %s' % name) +@click.option('-c', '--count', type=click.INT, default=1) +@click.argument("first", type=click.STRING, autocompletion=["John", "Bob", "Fred"]) +@click.argument("last", type=click.STRING, autocompletion=["Smith", "Simon", "Doe"]) +def cmd1(count, first, last): + for c in range(count): + click.echo('Name: %s %s' % (first, last)) def get_env_vars(ctx, incomplete, cwords, cword): return os.environ.keys() |