forked from pallets/click
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for autocompletion of arguments, intending to fix issue p…
- Loading branch information
Claudio Bandera
committed
Sep 20, 2015
1 parent
89d3bfd
commit c86487b
Showing
6 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
$ bashcompletion | ||
|
||
bashcompletion is a simple example of an application that | ||
tries to autocomplete commands, arguments and options. | ||
|
||
This example requires Click 2.0 or higher. | ||
|
||
Usage: | ||
|
||
$ pip install --editable . | ||
$ eval "$(_BASHCOMPLETION_COMPLETE=source bashcompletion)" | ||
$ bashcompletion --help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import click | ||
|
||
@click.group() | ||
def cli(): | ||
pass | ||
|
||
@cli.command() | ||
@click.argument("name", type=click.STRING, autocompletion=["John", "Simon", "Doe"]) | ||
@click.option('--debug/--no-debug', default=False) | ||
@click.option('-f', default=False) | ||
def cmd1(): | ||
pass | ||
|
||
@cli.command() | ||
def cmd2(): | ||
pass | ||
|
||
@cli.command() | ||
def cmd3(): | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from setuptools import setup | ||
|
||
setup( | ||
name='click-example-bashcompletion', | ||
version='1.0', | ||
py_modules=['bashcompletion'], | ||
include_package_data=True, | ||
install_requires=[ | ||
'click', | ||
], | ||
entry_points=''' | ||
[console_scripts] | ||
bashcompletion=bashcompletion:cli | ||
''', | ||
) |