rich_click.rich_help_rendering
Attributes
| Name | Description |
|---|---|
RichPanelRow | No description. |
Classes
| Name | Description |
|---|---|
RichClickRichPanel | A console renderable that draws a border around its contents. |
Functions
| Name | Description |
|---|---|
get_command_rich_table_row | Create a row for the rich table corresponding with this command. |
get_help_parameter | Build primary help text for a click option or argument. |
get_parameter_rich_table_row | Create a row for the rich table corresponding with this parameter. |
get_rich_epilog | Richly render a click Command's epilog if it exists. |
get_rich_help_text | Write rich help text to the formatter if it exists. |
get_rich_usage | Richly render usage text. |
rich_format_error | Print richly formatted click errors. |
RichPanelRowattributemodule attribute#
RichPanelRow = list[RenderableType | None]RichClickRichPanelclass#
class RichClickRichPanel(*args: Any, title_padding: int = 1, **kwargs: Any)Bases: Panel
A console renderable that draws a border around its contents.
This is a patched version of rich.panel.Panel that has additional features useful for rendering help text with rich-click.
Create RichClickRichPanel instance.
Parameters
title_paddingattributeinstance attribute#
title_padding = title_paddingget_command_rich_table_rowfunction#
def get_command_rich_table_row(command: click.Command, ctx: RichContext, formatter: RichHelpFormatter, panel: RichCommandPanel | None) -> RichPanelRowCreate a row for the rich table corresponding with this command.
get_help_parameterfunction#
def get_help_parameter(param: click.Argument | click.Option | RichParameter, ctx: RichContext, formatter: RichHelpFormatter) -> ColumnsBuild primary help text for a click option or argument. Returns the prose help text for an option or argument, rendered either as a Rich Text object or as Markdown. Additional elements are appended to show the default and required status if applicable.
Parameters
| Name | Type | Description |
|---|---|---|
param | click.Argument | click.Option | RichParameter | Parameter to build help text for. |
ctx | RichContext | Click Context object. |
formatter | RichHelpFormatter | Formatter object. |
Returns
ColumnsColumns- A columns element with multiple styled objects (help, default, required)
get_parameter_rich_table_rowfunction#
def get_parameter_rich_table_row(param: click.Argument | click.Option | RichParameter, ctx: RichContext, formatter: RichHelpFormatter, panel: RichOptionPanel | None) -> RichPanelRowCreate a row for the rich table corresponding with this parameter.
get_rich_epilogfunction#
def get_rich_epilog(ctx: RichContext, formatter: RichHelpFormatter) -> NoneRichly render a click Command’s epilog if it exists.
get_rich_help_textfunction#
def get_rich_help_text(ctx: RichContext, formatter: RichHelpFormatter) -> NoneWrite rich help text to the formatter if it exists.
get_rich_usagefunction#
def get_rich_usage(formatter: RichHelpFormatter, prog: str, args: str = '', prefix: str | None = None) -> NoneRichly render usage text.
rich_format_errorfunction#
def rich_format_error(formatter: RichHelpFormatter, export_console_as: Literal[None, 'html', 'svg'] = None) -> NonePrint richly formatted click errors.
Called by custom exception handler to print richly formatted click errors. Mimics original click.ClickException.echo() function but with rich formatting.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | click.ClickException | required | Click exception to format. |
formatter | RichHelpFormatter | required | formatter object. |
export_console_as | Literal[None, 'html', 'svg'] | None | If set, outputs error message as HTML or SVG. |