diff options
author | David Lord <davidism@gmail.com> | 2021-05-27 07:31:01 -0700 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2021-05-27 07:31:01 -0700 |
commit | 48cb86d85fc1abfcf1478ee660e42aaa5382fd64 (patch) | |
tree | eb922b6518cb24b0605a5cabf96a8b85b6e34064 | |
parent | 6e0311810340704891546244c4bf932a50c8f40f (diff) | |
download | click-48cb86d85fc1abfcf1478ee660e42aaa5382fd64.tar.gz |
fix completion example
-rw-r--r-- | examples/completion/README | 6 | ||||
-rw-r--r-- | examples/completion/completion.py | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/examples/completion/README b/examples/completion/README index f15654e..372b1d4 100644 --- a/examples/completion/README +++ b/examples/completion/README @@ -11,18 +11,18 @@ For Bash: .. code-block:: bash - eval "$(_COMPLETION_COMPLETE=source_bash completion)" + eval "$(_COMPLETION_COMPLETE=bash_source completion)" For Zsh: .. code-block:: zsh - eval "$(_COMPLETION_COMPLETE=source_zsh completion)" + eval "$(_COMPLETION_COMPLETE=zsh_source completion)" For Fish: .. code-block:: fish - eval (env _COMPLETION_COMPLETE=source_fish completion) + eval (env _COMPLETION_COMPLETE=fish_source completion) Now press tab (maybe twice) after typing something to see completions. diff --git a/examples/completion/completion.py b/examples/completion/completion.py index abd09c0..6c45a1f 100644 --- a/examples/completion/completion.py +++ b/examples/completion/completion.py @@ -38,10 +38,13 @@ def list_users(ctx, param, incomplete): # of CompletionItem. You can match on whatever you want, including # the help. items = [("bob", "butcher"), ("alice", "baker"), ("jerry", "candlestick maker")] + out = [] for value, help in items: if incomplete in value or incomplete in help: - yield CompletionItem(value, help=help) + out.append(CompletionItem(value, help=help)) + + return out @group.command(help="Choose a user") |