Print full help reference.
(ctx: click.Context, command_name: str)
| 406 | ) |
| 407 | @click.pass_context |
| 408 | def help_command(ctx: click.Context, command_name: str): |
| 409 | """Print full help reference.""" |
| 410 | # TODO: Other commands still seem to run if this is specified. |
| 411 | assert ctx.parent is not None |
| 412 | assert isinstance(ctx.parent.command, click.Group) |
| 413 | parent_command = ctx.parent.command |
| 414 | all_commands = set(parent_command.list_commands(ctx)) |
| 415 | if command_name is not None: |
| 416 | if command_name not in all_commands: |
| 417 | error_strs = [ |
| 418 | "unknown command. List of valid commands:", |
| 419 | " {}".format(", ".join(sorted(all_commands))), |
| 420 | ] |
| 421 | raise click.BadParameter("\n".join(error_strs), param_hint="command") |
| 422 | click.echo("") |
| 423 | target = parent_command.get_command(ctx, command_name) |
| 424 | assert target is not None |
| 425 | print_command_help(ctx, target) |
| 426 | else: |
| 427 | click.echo(ctx.parent.get_help()) |
| 428 | for command in sorted(all_commands): |
| 429 | target = parent_command.get_command(ctx, command) |
| 430 | assert target is not None |
| 431 | print_command_help(ctx, target) |
| 432 | ctx.exit() |
| 433 | |
| 434 | |
| 435 | @click.command("about", cls=Command, add_help_option=False) |
nothing calls this directly
no test coverage detected