Skip to content
Myr

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

5 files+99 added−3 removed

added:.github/workflows/nightly.yaml+42 added
modified:docs/documentation.md+40 added
48 unmodified lines
49.. click:run::50 invoke(cli, args=['--help'])51```5253## Group Help Page5455The group help prints sub commands, options, epilog help, and arguments, and prints them together.5657```{eval-rst}58.. click:example::5960 import click6162 @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."""6869 @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}!")8889.. click:run::90 invoke(cli, args=['--help'])91```9293## Command Epilog Help9495The 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 lines
modified:src/click/shell_completion.py+3 added-3 removed
417 unmodified lines
418 return args, incomplete419420 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 tab
248 unmodified lines
modified:tests/test_shell_completion.py+9 added
10 unmodified lines
11from click.core import Group12from click.core import Option13from click.shell_completion import add_completion_class14from click.shell_completion import CompletionItem15from click.shell_completion import FishComplete16from click.shell_completion import shell_complete17from click.shell_completion import ShellComplete18from click.types import Choice19from click.types import File
556 unmodified lines
576 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"580581582def 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 lines
10-------------1112Unreleased1314- 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`181920Version 8.4.121-------------2223Released 2026-05-21
1473 unmodified lines