From dfb15ee66a119e85def0bd69e39e64f69a883f2f Mon Sep 17 00:00:00 2001 From: Anurag Saxena Date: Mon, 18 May 2026 16:44:25 -0700 Subject: [PATCH 1/2] Add example for Group Help Page in documentation --- docs/documentation.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/docs/documentation.md b/docs/documentation.md index a031773344..4e0d287b7b 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -50,6 +50,46 @@ For subcommands, a short help snippet is generated. By default, it's the first s invoke(cli, args=['--help']) ``` +## Group Help Page + +The group help prints sub commands, options, epilog help, and arguments, and prints them together. + +```{eval-rst} +.. click:example:: + + import click + + @click.group( + help="Example Click app with subcommands, options, and positional arguments.", + epilog=("Examples:\n\n\b\n python hello.py greet Alice --count 2\n"), + ) + def cli() -> None: + """Run the example CLI.""" + + @cli.command() + @click.argument("name") + @click.option( + "--count", + default=1, + show_default=True, + type=click.IntRange(1, None), + help="Number of greetings to print.", + ) + @click.option( + "--greeting", + default="Hello", + show_default=True, + help="Greeting prefix to use.", + ) + def greet(name: str, count: int, greeting: str) -> None: + """Greet NAME one or more times.""" + for _ in range(count): + click.echo(f"{greeting} {name}!") + +.. click:run:: + invoke(init, args=['--help']) +``` + ## Command Epilog Help The help epilog is printed at the end of the help and is useful for showing example command usages or referencing additional help resources. From 7fb117a9aeb82e0d5260b8935ab4a8bab6291aec Mon Sep 17 00:00:00 2001 From: Anurag Saxena Date: Tue, 19 May 2026 07:36:17 -0700 Subject: [PATCH 2/2] fix: update example invocation in Group Help Page documentation --- docs/documentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/documentation.md b/docs/documentation.md index 4e0d287b7b..0004efd139 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -87,7 +87,7 @@ The group help prints sub commands, options, epilog help, and arguments, and pri click.echo(f"{greeting} {name}!") .. click:run:: - invoke(init, args=['--help']) + invoke(cli, args=['--help']) ``` ## Command Epilog Help