display_help¶
- safir.click.display_help(main, ctx, topic=None, subtopic=None)¶
Show help for a Click command.
This function implements a help command for command-line interfaces using Click. It supports commands and subcommands, displaying the same information as would be shown by
--help
. The resulting help text is displayed withclick.echo
.- Parameters:
- Raises:
click.UsageError – Raised if the given help topic or subtopic does not correspond to a registered Click command.
RuntimeError – Raised if the Click context has no parent, meaning that this was called with an invalid context or from the top-level Click command.
- Return type:
Examples
This function should normally be called from a top-level
help
command. Assuming that the top-level Click group is namedmain
, here is the typical usage:@main.command() @click.argument("topic", default=None, required=False, nargs=1) @click.argument("subtopic", default=None, required=False, nargs=1) @click.pass_context def help( ctx: click.Context, topic: str | None, subtopic: str | None ) -> None: display_help(main, ctx, topic, subtopic)