Skip to content
Myr

Correct ZSH completion definitions

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nick Cross · committed by David Lord · parent 716a5be · Browse files · 3 files+14 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+14 added−0 removed

  • tests:+8 added−0 removed
  • other:+6 added−0 removed

3 files+14 added−0 removed

modified:click/_bashcomplete.py+4 added
37 unmodified lines
38%(complete_func)setup39'''4041COMPLETION_SCRIPT_ZSH = '''42#compdef %(script_names)s4344%(complete_func)s() {45 local -a completions46 local -a completions_with_descriptions47 local -a response48 (( ! $+commands[%(script_names)s] )) && return 14950 response=("${(@f)$( env COMP_WORDS=\"${words[*]}\" \\51 COMP_CWORD=$((CURRENT-1)) \\52 %(autocomplete_var)s=\"complete_zsh\" \\53 %(script_names)s )}")
244 unmodified lines
modified:tests/test_compat.py+8 added
23 unmodified lines
24 assert script.startswith('_foo_barbaz_blah_completion()')25 assert '_COMPLETE_VAR=complete $1' in script262728def test_zsh_func_name():29 from click._bashcomplete import get_completion_script30 script = get_completion_script('foo-bar', '_COMPLETE_VAR', 'zsh').strip()31 assert script.startswith('#compdef foo-bar')32 assert 'compdef _foo_bar_completion foo-bar;' in script33 assert '(( ! $+commands[foo-bar] )) && return 1' in script343536@pytest.mark.xfail(WIN, reason="Jupyter not tested/supported on Windows")37def test_is_jupyter_kernel_output():38 class JupyterKernelFakeStream(object):39 pass
4 unmodified lines
modified:CHANGES.rst+2 added
4 unmodified lines
5-----------67Unreleased89- Fix autoloading for ZSH completion and add error handling. (`#1348`_ )10- Adds a repr to Command, showing the command name for friendlier debugging. (`#1267`_, `#1295`_)11- Add support for distinguishing the source of a command line parameter. (`#1264`_, `#1329`_)12- Add an optional parameter to ``ProgressBar.update`` to set the13 ``current_item``. (`#1226`_, `#1332`_)
2 unmodified lines
16.. _#1295: https://github.com/pallets/click/pull/129517.. _#1264: https://github.com/pallets/click/issues/126418.. _#1329: https://github.com/pallets/click/pull/132919.. _#1226: https://github.com/pallets/click/issues/122620.. _#1348: https://github.com/pallets/click/pull/134821.. _#1332: https://github.com/pallets/click/pull/1332222324Version 7.1
647 unmodified lines