ArgumentInfo
This class provides a comprehensive structure for defining command-line arguments, extending the base parameter information with specialized metadata. It supports a wide range of configurations including default values, environment variables, validation constraints for numbers and paths, and custom parsing logic. Additionally, it includes settings for help text generation and integration with rich formatting panels.
Constructor
Signature
def ArgumentInfo(
default: Any | None = None,
param_decls: Sequence[str]| None = None,
callback: Callable[..., Any]| None = None,
metavar: str | None = None,
expose_value: bool = True,
is_eager: bool = False,
envvar: str | list[str]| None = None,
shell_complete: Callable | None = None,
autocompletion: Callable[..., Any]| None = None,
default_factory: Callable[[], Any]| None = None,
parser: Callable[[str], Any]| None = None,
click_type: click.ParamType | None = None,
show_default: bool | str = True,
show_choices: bool = True,
show_envvar: bool = True,
help: str | None = None,
hidden: bool = False,
case_sensitive: bool = True,
min: int | float | None = None,
max: int | float | None = None,
clamp: bool = False,
formats: list[str]| None = None,
mode: str | None = None,
encoding: str | None = None,
errors: str | None = "strict",
lazy: bool | None = None,
atomic: bool = False,
exists: bool = False,
file_okay: bool = True,
dir_okay: bool = True,
writable: bool = False,
readable: bool = True,
resolve_path: bool = False,
allow_dash: bool = False,
path_type: None | type[str]| type[bytes] = None,
rich_help_panel: str | None = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| default | `Any | None` = None |
| param_decls | `Sequence[str] | None` = None |
| callback | `Callable[..., Any] | None` = None |
| metavar | `str | None` = None |
| expose_value | bool = True | Whether to pass the value to the function. |
| is_eager | bool = False | Whether to process this parameter before others. |
| envvar | `str | list[str] |
| shell_complete | `Callable | None` = None |
| autocompletion | `Callable[..., Any] | None` = None |
| default_factory | `Callable[[], Any] | None` = None |
| parser | `Callable[[str], Any] | None` = None |
| click_type | `click.ParamType | None` = None |
| show_default | `bool | str` = True |
| show_choices | bool = True | Whether to show valid choices in help text. |
| show_envvar | bool = True | Whether to show the environment variable in help text. |
| help | `str | None` = None |
| hidden | bool = False | Whether to hide this argument from help output. |
| case_sensitive | bool = True | Whether choice matching is case sensitive. |
| min | `int | float |
| max | `int | float |
| clamp | bool = False | Whether to clamp numeric values to the min/max range. |
| formats | `list[str] | None` = None |
| mode | `str | None` = None |
| encoding | `str | None` = None |
| errors | `str | None` = "strict" |
| lazy | `bool | None` = None |
| atomic | bool = False | Whether file writes should be atomic. |
| exists | bool = False | Whether the path must exist. |
| file_okay | bool = True | Whether a file is a valid path. |
| dir_okay | bool = True | Whether a directory is a valid path. |
| writable | bool = False | Whether the path must be writable. |
| readable | bool = True | Whether the path must be readable. |
| resolve_path | bool = False | Whether to resolve the path to an absolute path. |
| allow_dash | bool = False | Whether to allow '-' for stdin/stdout. |
| path_type | `None | type[str] |
| rich_help_panel | `str | None` = None |
Signature
def ArgumentInfo(
default: Any | None = None,
param_decls: Sequence[str]| None = None,
callback: Callable[..., Any]| None = None,
metavar: str | None = None,
expose_value: bool = True,
is_eager: bool = False,
envvar: str | list[str]| None = None,
shell_complete: Callable | None = None,
autocompletion: Callable[..., Any]| None = None,
default_factory: Callable[[], Any]| None = None,
parser: Callable[[str], Any]| None = None,
click_type: click.ParamType | None = None,
show_default: bool | str = True,
show_choices: bool = True,
show_envvar: bool = True,
help: str | None = None,
hidden: bool = False,
case_sensitive: bool = True,
min: int | float | None = None,
max: int | float | None = None,
clamp: bool = False,
formats: list[str]| None = None,
mode: str | None = None,
encoding: str | None = None,
errors: str | None = "strict",
lazy: bool | None = None,
atomic: bool = False,
exists: bool = False,
file_okay: bool = True,
dir_okay: bool = True,
writable: bool = False,
readable: bool = True,
resolve_path: bool = False,
allow_dash: bool = False,
path_type: None | type[str]| type[bytes] = None,
rich_help_panel: str | None = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| default | `Any | None` = None |
| param_decls | `Sequence[str] | None` = None |
| callback | `Callable[..., Any] | None` = None |
| metavar | `str | None` = None |
| expose_value | bool = True | Whether the value should be passed to the command function or only used for side effects. |
| is_eager | bool = False | Whether to process this parameter before others to handle high-priority flags like --version. |
| envvar | `str | list[str] |
| shell_complete | `Callable | None` = None |
| autocompletion | `Callable[..., Any] | None` = None |
| default_factory | `Callable[[], Any] | None` = None |
| parser | `Callable[[str], Any] | None` = None |
| click_type | `click.ParamType | None` = None |
| show_default | `bool | str` = True |
| show_choices | bool = True | Whether to list all valid choices for the argument in the help text. |
| show_envvar | bool = True | Whether to display the associated environment variable in the help text. |
| help | `str | None` = None |
| hidden | bool = False | If true, the argument will be functional but omitted from the help documentation. |
| case_sensitive | bool = True | Determines if string choice validation should respect character casing. |
| min | `int | float |
| max | `int | float |
| clamp | bool = False | If true, values outside the min/max range will be set to the nearest boundary instead of raising an error. |
| formats | `list[str] | None` = None |
| mode | `str | None` = None |
| encoding | `str | None` = None |
| errors | `str | None` = "strict" |
| lazy | `bool | None` = None |
| atomic | bool = False | If true, file writes are performed to a temporary file and moved to the destination upon success. |
| exists | bool = False | If true, the provided path must already exist on the filesystem. |
| file_okay | bool = True | Whether the path is allowed to point to a file. |
| dir_okay | bool = True | Whether the path is allowed to point to a directory. |
| writable | bool = False | If true, the path must have write permissions. |
| readable | bool = True | If true, the path must have read permissions. |
| resolve_path | bool = False | If true, converts the input path to an absolute path and resolves symlinks. |
| allow_dash | bool = False | If true, allows '-' to represent stdin or stdout. |
| path_type | `None | type[str] |
| rich_help_panel | `str | None` = None |