Skip to main content

CommandInfo

This class serves as a data container for storing configuration and metadata related to a command. It encapsulates various attributes such as the command name, callback function, help text, and display settings to facilitate command registration and execution. Additionally, it supports advanced formatting options like Rich help panels and deprecated status flags.

Attributes

AttributeTypeDescription
name`strNone`
cls`type[TyperCommand]None`
context_settings`dict[Any, Any]None`
callback`Callable[..., Any]None`
help`strNone`
epilog`strNone`
short_help`strNone`
options_metavarstr = [OPTIONS]The string used to represent options in the command's usage help text.
add_help_optionbool = trueWhether to automatically include the default help option for this command.
no_args_is_helpbool = falseWhether to display the help page automatically if the command is called without arguments.
hiddenbool = falseWhether to hide this command from the help list of the parent group.
deprecatedbool = falseWhether to display a warning indicating that this command is deprecated.
rich_help_panel`strNone`

Constructor

Signature

def CommandInfo(
name: str | None = None,
cls: type[[TyperCommand](../core/typercommand.md?sid=typer_core_typercommand)]| None = None,
context_settings: dict[Any, Any]| None = None,
callback: Callable[..., Any]| None = None,
help: str | None = None,
epilog: str | None = None,
short_help: str | None = None,
options_metavar: str = [OPTIONS],
add_help_option: bool = True,
no_args_is_help: bool = False,
hidden: bool = False,
deprecated: bool = False,
rich_help_panel: str | None = None
) - > null

Parameters

NameTypeDescription
name`strNone` = None
cls`type[TyperCommand]None` = None
context_settings`dict[Any, Any]None` = None
callback`Callable[..., Any]None` = None
help`strNone` = None
epilog`strNone` = None
short_help`strNone` = None
options_metavarstr = [OPTIONS]The metavar for options in the help text.
add_help_optionbool = TrueWhether to automatically add a help option.
no_args_is_helpbool = FalseWhether to show help if no arguments are provided.
hiddenbool = FalseWhether to hide the command from help menus.
deprecatedbool = FalseWhether to mark the command as deprecated.
rich_help_panel`strNone` = None

Signature

def CommandInfo(
name: str | None = None,
cls: type[[TyperCommand](../core/typercommand.md?sid=typer_core_typercommand)]| None = None,
context_settings: dict[Any, Any]| None = None,
callback: Callable[..., Any]| None = None,
help: str | None = None,
epilog: str | None = None,
short_help: str | None = None,
options_metavar: str = "[OPTIONS]",
add_help_option: bool = True,
no_args_is_help: bool = False,
hidden: bool = False,
deprecated: bool = False,
rich_help_panel: str | None = None
)

Parameters

NameTypeDescription
name`strNone` = None
cls`type[TyperCommand]None` = None
context_settings`dict[Any, Any]None` = None
callback`Callable[..., Any]None` = None
help`strNone` = None
epilog`strNone` = None
short_help`strNone` = None
options_metavarstr = "[OPTIONS]"The string used to represent options in the command usage help text.
add_help_optionbool = TrueDetermines whether to automatically add a --help option to the command.
no_args_is_helpbool = FalseIf true, shows the help page automatically when the command is called without arguments.
hiddenbool = FalseIf true, excludes the command from the help list while keeping it executable.
deprecatedbool = FalseIf true, displays a deprecation warning when the command is used.
rich_help_panel`strNone` = None