Merge branch 'stable'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kevin Deldycke · committed by Kevin Deldycke · parents c353590, 648d7c4 · Browse files · 5 files·+99 added−3 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+99 added−3 removed
- tests:+9 added−0 removed
- other:+90 added−3 removed
Provenance
- Commit
3a40e43- Tree
278e905- Author
Kevin Deldycke <kevin@deldycke.com>- Committer
Kevin Deldycke <kevin@deldycke.com>- Parent 1
c353590- Parent 2
648d7c4
5 files changed+99 added−3 removed
added:.github/workflows/nightly.yaml+42 added
123456789101112131415161718192021222324252627282930313233343536373839404142name: Nightly race testson: schedule: - cron: '0 6 * * *' workflow_dispatch:permissions: {}concurrency: group: ${{ github.workflow }} cancel-in-progress: falsejobs: race-tests: name: ${{ matrix.name }} runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: fail-fast: false matrix: include: - {name: Random 3.14, python: '3.14', tox: random} - {name: Random 3.14t, python: '3.14t', tox: random} - {name: Random 3.13, python: '3.13', tox: random} - {name: Random 3.12, python: '3.12', tox: random} - {name: Random 3.11, python: '3.11', tox: random} - {name: Random 3.10, python: '3.10', tox: random} - {name: Random Windows, python: '3.14', tox: random, os: windows-latest} - {name: Random Mac, python: '3.14', tox: random, os: macos-latest} - {name: Stress 3.14, python: '3.14', tox: stress-py3.14} - {name: Stress 3.14t, python: '3.14t', tox: stress-py3.14t} - {name: Stress Mac 3.14t, python: '3.14t', tox: stress-py3.14t, os: macos-latest} steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 with: enable-cache: true prune-cache: false - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: ${{ matrix.python }} - run: uv run --locked --no-default-groups --group dev tox run env: TOX_ENV: ${{ matrix.tox }}modified:docs/documentation.md+40 added
48 unmodified lines49 .. click:run::50 invoke(cli, args=['--help'])51 ```52 53+## Group Help Page54+55+The group help prints sub commands, options, epilog help, and arguments, and prints them together.56+57+```{eval-rst}58+.. click:example::59+60+ import click61+62+ @click.group(63+ help="Example Click app with subcommands, options, and positional arguments.",64+ epilog=("Examples:\n\n\b\n python hello.py greet Alice --count 2\n"),65+ )66+ def cli() -> None:67+ """Run the example CLI."""68+69+ @cli.command()70+ @click.argument("name")71+ @click.option(72+ "--count",73+ default=1,74+ show_default=True,75+ type=click.IntRange(1, None),76+ help="Number of greetings to print.",77+ )78+ @click.option(79+ "--greeting",80+ default="Hello",81+ show_default=True,82+ help="Greeting prefix to use.",83+ )84+ def greet(name: str, count: int, greeting: str) -> None:85+ """Greet NAME one or more times."""86+ for _ in range(count):87+ click.echo(f"{greeting} {name}!")88+89+.. click:run::90+ invoke(cli, args=['--help'])91+```92+93 ## Command Epilog Help94 95 The help epilog is printed at the end of the help and is useful for showing example command usages or referencing additional help resources.96 237 unmodified linesmodified:src/click/shell_completion.py+3 added-3 removed
417 unmodified lines418 return args, incomplete419 420 def format_completion(self, item: CompletionItem) -> str:421 """422- .. versionchanged:: 8.4.0423- Escape newlines in value and help to fix completion errors with424- multi-line help strings.422+ .. versionchanged:: 8.4.2423+ Escape newlines and replace tabs with spaces in the help text to424+ fix completion errors with multi-line help strings.425 """426 # According to https://fishshell.com/docs/current/cmds/complete.html427 # Command substitutions found in ARGUMENTS should return a newline-428 # separated list of arguments, and each argument may optionally have a tab248 unmodified linesmodified:tests/test_shell_completion.py+9 added
10 unmodified lines11 from click.core import Group12 from click.core import Option13 from click.shell_completion import add_completion_class14 from click.shell_completion import CompletionItem15+from click.shell_completion import FishComplete16 from click.shell_completion import shell_complete17 from click.shell_completion import ShellComplete18 from click.types import Choice19 from click.types import File556 unmodified lines576 with warnings.catch_warnings(record=True) as current_warnings:577 assert not current_warnings, "There should be no warnings to start"578 _get_completions(cli, args=[], incomplete="")579 assert not current_warnings, "There should be no warnings after either"580+581+582+def test_fish_format_completion_escapes_help():583+ fc = FishComplete(Command("x"), {}, "x", "_X_COMPLETE")584+ item = CompletionItem("--at", help="first\nsecond\tthird")585+ # The newline is escaped to the literal characters backslash-n and the tab586+ # becomes a space, so each completion stays on one line for fish.587+ assert fc.format_completion(item) == "plain,--at\tfirst\\nsecond third"modified:CHANGES.rst+5 added
9 unmodified lines10 -------------11 12 Unreleased13 14+- Fix Fish shell completion broken in ``8.4.0`` by :pr:`3126`. Newlines and15+ tabs in option help text are now escaped, keeping the original completion16+ format while still supporting multi-line help. :issue:`3502`17+ :issue:`3043` :pr:`3504` :pr:`3508`18 19+20 Version 8.4.121 -------------22 23 Released 2026-05-211473 unmodified lines