Last active
May 31, 2019 17:18
-
-
Save dlovell/0357739ac6c9a6220208de909bc4bc6a to your computer and use it in GitHub Desktop.
click issue 721
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
_github_issue_721_completion() { | |
local IFS=$' | |
' | |
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \ | |
COMP_CWORD=$COMP_CWORD \ | |
_GITHUB_ISSUE_721_COMPLETE=complete $1 ) ) | |
return 0 | |
} | |
complete -F _github_issue_721_completion -o default github_issue_721; |
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
import click | |
@click.group() | |
@click.help_option() | |
def sample(): | |
pass | |
@sample.command() | |
@click.argument('mode', nargs=1, required=False, type=click.STRING) | |
def access(mode): | |
click.echo(mode) | |
@sample.command() | |
@click.option('--password', prompt=True, hide_input=True, confirmation_prompt=True) | |
def permissions(password): | |
print(password) | |
@sample.group() | |
@click.help_option() | |
def sub_sample(): | |
pass | |
@sub_sample.command() | |
def set(): | |
pass | |
@sub_sample.command() | |
def get(): | |
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
import click | |
from github_issue_721.catalog.sample import sample | |
@click.group() | |
def cli() -> None: | |
pass | |
cli.add_command(sample) | |
if __name__ == '__main__': | |
cli() |
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
from setuptools import setup | |
setup( | |
name='github_issue_721', | |
version='0.1', | |
py_modules=['github_issue_721_cli'], | |
packages=[ | |
'github_issue_721.catalog', | |
], | |
include_package_data=True, | |
install_requires=[ | |
'click', | |
], | |
entry_points=''' | |
[console_scripts] | |
github_issue_721=github_issue_721_cli:cli | |
''', | |
) |
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
dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ python3 -m venv env | |
dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ . env/bin/activate | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ pip install click >/dev/null 2>&1 && echo success || echo failure | |
success | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ pip install --editable . >/dev/null 2>&1 && echo success || echo failure | |
success | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ eval "$(_GITHUB_ISSUE_721_COMPLETE=source github_issue_721)" | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ github_issue_721 | |
github_issue_721 | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ github_issue_721 sample | |
access permissions sub-sample | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ github_issue_721 sample access # no more completions | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ github_issue_721 sample sub-sample | |
get set | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ github_issue_721 sample sub-sample get # no more completions | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ . faulty-completion-script.sh | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ github_issue_721 | |
github_issue_721 | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ github_issue_721 sample | |
access permissions sub-sample | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ github_issue_721 sample access | |
env/ github_issue_721/ __pycache__/ | |
faulty-completion-script.sh github_issue_721_cli.py setup.py | |
.git/ github_issue_721.egg-info/ | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ github_issue_721 sample sub-sample | |
get set | |
(env) dlovell@gauss:~/Projects/tsos-pallets/github_issue_721$ github_issue_721 sample sub-sample get | |
env/ github_issue_721/ __pycache__/ | |
faulty-completion-script.sh github_issue_721_cli.py setup.py | |
.git/ github_issue_721.egg-info/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment