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
| Attribute | Type | Description |
|---|---|---|
| name | `str | None` |
| cls | `type[TyperCommand] | None` |
| context_settings | `dict[Any, Any] | None` |
| callback | `Callable[..., Any] | None` |
| help | `str | None` |
| epilog | `str | None` |
| short_help | `str | None` |
| options_metavar | str = [OPTIONS] | The string used to represent options in the command's usage help text. |
| add_help_option | bool = true | Whether to automatically include the default help option for this command. |
| no_args_is_help | bool = false | Whether to display the help page automatically if the command is called without arguments. |
| hidden | bool = false | Whether to hide this command from the help list of the parent group. |
| deprecated | bool = false | Whether to display a warning indicating that this command is deprecated. |
| rich_help_panel | `str | None` |
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
| Name | Type | Description |
|---|---|---|
| name | `str | None` = None |
| cls | `type[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] | The metavar for options in the help text. |
| add_help_option | bool = True | Whether to automatically add a help option. |
| no_args_is_help | bool = False | Whether to show help if no arguments are provided. |
| hidden | bool = False | Whether to hide the command from help menus. |
| deprecated | bool = False | Whether to mark the command as deprecated. |
| rich_help_panel | `str | None` = 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
| Name | Type | Description |
|---|---|---|
| name | `str | None` = None |
| cls | `type[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]" | The string used to represent options in the command usage help text. |
| add_help_option | bool = True | Determines whether to automatically add a --help option to the command. |
| no_args_is_help | bool = False | If true, shows the help page automatically when the command is called without arguments. |
| hidden | bool = False | If true, excludes the command from the help list while keeping it executable. |
| deprecated | bool = False | If true, displays a deprecation warning when the command is used. |
| rich_help_panel | `str | None` = None |