Skip to content
Myr

Fix completions for quoted/escaped parameters in Fish (#3013)

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

authored by Hans Lehnert · committed by GitHub · parent 3be1f33 · Browse files · 2 files+3 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

2 files+3 added−0 removed

  • tests:+1 added−0 removed
  • other:+2 added−0 removed

2 files+3 added−0 removed

modified:src/click/shell_completion.py+2 added
403 unmodified lines
404405 def get_completion_args(self) -> tuple[list[str], str]:406 cwords = split_arg_string(os.environ["COMP_WORDS"])407 incomplete = os.environ["COMP_CWORD"]408 if incomplete:409 incomplete = split_arg_string(incomplete)[0]410 args = cwords[1:]411412 # Fish stores the partial word in both COMP_WORDS and413 # COMP_CWORD, remove it from complete args.
254 unmodified lines
modified:tests/test_shell_completion.py+1 added
357 unmodified lines
358 ("zsh", {"COMP_WORDS": "", "COMP_CWORD": "0"}, "plain\na\n_\nplain\nb\nbee\n"),359 ("zsh", {"COMP_WORDS": "a b", "COMP_CWORD": "1"}, "plain\nb\nbee\n"),360 ("fish", {"COMP_WORDS": "", "COMP_CWORD": ""}, "plain,a\nplain,b\tbee\n"),361 ("fish", {"COMP_WORDS": "a b", "COMP_CWORD": "b"}, "plain,b\tbee\n"),362 ("fish", {"COMP_WORDS": 'a "b', "COMP_CWORD": '"b'}, "plain,b\tbee\n"),363 ],364)365@pytest.mark.usefixtures("_patch_for_completion")366def test_full_complete(runner, shell, env, expect):
195 unmodified lines