Skip to content
Myr

Cleanup #3126

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

Link to PR in changelog, move implementation details to Python code, fix changed version and align `.gitignore` syntax

authored by Kevin Deldycke · committed by Kevin Deldycke · parent cf1d891 · Browse files · 3 files+11 added−10 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+11 added−10 removed

  • other:+11 added−10 removed

3 files+11 added−10 removed

modified:src/click/shell_completion.py+9 added-8 removed
419 unmodified lines
420421 return args, incomplete422423 def format_completion(self, item: CompletionItem) -> str:424 """Format completion item for Fish shell.425426 Escapes newlines in both value and help text to prevent427 Fish shell parsing errors.428429 .. versionchanged:: 8.3430 Escape newlines in help text to fix completion errors431 with multi-line help strings.424 """425 .. versionchanged:: 8.4426 Escape newlines in value and help to fix completion errors with427 multi-line help strings.428 """429 # The fish completion script splits each response line on literal430 # newlines, so any newline in the value or help would corrupt the431 # frame. Replace them with the two-character escape "\n" so the text432 # round-trips through fish without breaking the format. The "_"433 # sentinel for missing help mirrors :class:`ZshComplete`.434 help_ = item.help or "_"435 value = item.value.replace("\n", r"\n")436 help_escaped = help_.replace("\n", r"\n")437 return f"{item.type}\n{value}\n{help_escaped}"
242 unmodified lines
modified:.gitignore+1 added-1 removed
4 unmodified lines
5.coverage*6htmlcov/7.tox/8docs/_build/9.venv9.venv/
modified:CHANGES.rst+1 added-1 removed
47 unmodified lines
48- Use :func:`os.startfile` on Windows to open URLs in :func:`open_url`,49 replacing the ``start`` built-in which cannot be invoked without50 ``shell=True``. :issue:`3164` :pr:`3186`51- Fix Fish shell completion errors when option help text contains newlines.52 :issue:`3043`52 :issue:`3043` :pr:`3126`53- Add :class:`NoSuchCommand` exception with suggestions for misspelled54 commands. :issue:`3107` :pr:`3228`55- Use :class:`ValueError` message when conversion in :class:`FuncParamType` would56 fail. :issue:`3105` :pr:`3211`
1374 unmodified lines