Skip to content

rich_click.patch

Patch click, Typer or asyncclick so that their commands print help and errors with rich-click.

Functions

NameDescription
patchPatch Click internals to use rich-click types.
patch_typerPatch Typer so that its commands print help and errors with rich-click.

patchfunction#

def patch(rich_config: RichHelpConfiguration | None = None, *, patch_rich_click: bool = True, patch_typer: bool = False, module: Any | None = None) -> None

Patch Click internals to use rich-click types.

Parameters

NameTypeDefaultDescription
rich_configRichHelpConfiguration | NoneNoneHelp configuration to apply globally.
patch_rich_clickboolTrueAlso patch the rich_click namespace. Ignored when module is set.
patch_typerboolFalseAlso patch Typer. Ignored when module is set.
moduleAny | NoneNoneAn asynchronous click fork, such as asyncclick, to patch instead of click. rich-click then installs its async command classes into the namespace of that module. Requires rich-click[async].

Raises

TypeError
module is not an asynchronous click fork, such as asyncclick.

patch_typerfunction#

def patch_typer(rich_config: RichHelpConfiguration | None = None) -> None

Patch Typer so that its commands print help and errors with rich-click.

Parameters

NameTypeDefaultDescription
rich_configRichHelpConfiguration | NoneNoneHelp configuration for every command.