summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2021-07-04 07:56:52 -0700
committerDavid Lord <davidism@gmail.com>2021-07-04 07:56:52 -0700
commitce152bd7215038f762ee918e6e181a5309ad57c9 (patch)
tree7235fa389357c4cdcbf707018877a8ca6ed0f152 /examples
parentff72d7d50cae327786b73415f0f4dc348996215c (diff)
parent76cc18d1f0bd5854f14526e3ccbce631d8344cce (diff)
downloadclick-ce152bd7215038f762ee918e6e181a5309ad57c9.tar.gz
Merge remote-tracking branch 'origin/8.0.x'
Diffstat (limited to 'examples')
-rw-r--r--examples/completion/README6
-rw-r--r--examples/completion/completion.py5
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")