Skip to content
Myr

Merge pull request #1480 from pallets/zsh-autoload-backport

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

Backport ZSH autoloading to 7.1

authored by David Lord · committed by GitHub · parents 37d8970, 3106951 · Browse files · 3 files+13 added−1 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+13 added−1 removed

  • tests:+8 added−0 removed
  • other:+5 added−1 removed

3 files+13 added−1 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+1 added-1 removed
55 unmodified lines
56- Consider ``sensible-editor`` when determining the editor to use for57 ``click.edit()``. :pr:`1469`58- Arguments to system calls such as the executable path passed to59 ``click.edit`` can contains spaces. :pr:`1470`60- Add ZSH completion autoloading and error handling. :issue:`1348`616162Version 7.063-----------6465Released 2018-09-25
538 unmodified lines