ParameterInfo
This class serves as a comprehensive data container for command-line parameter configuration, storing metadata such as default values, callbacks, and environment variables. It supports a wide range of validation and formatting options for various data types, including files, paths, numbers, and dates. Additionally, it provides settings for controlling help text visibility and integration with rich terminal output.
Attributes
| Attribute | 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 | Determines whether the parameter value is passed to the command function. |
| is_eager | bool = false | If true, this parameter is processed before others to trigger early actions like printing version info. |
| 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 | Determines if the valid choices for the parameter should be shown in the help text. |
| show_envvar | bool = true | Determines if the associated environment variable should be shown in the help text. |
| help | `str | None` = None |
| hidden | bool = false | If true, the parameter will be functional but omitted from the help output. |
| case_sensitive | bool = true | Determines if string comparisons for choices should respect character casing. |
| min | `int | float |
| max | `int | float |
| clamp | bool = false | If true, values outside the min/max range will be clamped 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 atomically on close. |
| exists | bool = false | If true, the provided path must already exist on the filesystem. |
| file_okay | bool = true | Determines if the path parameter is allowed to be a file. |
| dir_okay | bool = true | Determines if the path parameter is allowed to be a directory. |
| writable | bool = false | If true, the path must have write permissions for the user. |
| readable | bool = true | If true, the path must have read permissions for the user. |
| resolve_path | bool = false | If true, the path will be converted to an absolute path with symlinks resolved. |
| allow_dash | bool = false | If true, allows a single dash '-' to represent standard input or output. |
| path_type | `None | type[str] |
| rich_help_panel | `str | None` = None |
Constructor
Signature
def ParameterInfo(
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
)
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 command 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 the parameter from help output. |
| case_sensitive | bool = True | Whether string choices are 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 files are allowed as paths. |
| dir_okay | bool = True | Whether directories are allowed as paths. |
| 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 '-' as a path for stdin/stdout. |
| path_type | `None | type[str] |
| rich_help_panel | `str | None` = None |
Signature
def ParameterInfo(
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 parameter value should be passed to the command function. |
| is_eager | bool = False | Whether this parameter should be processed before others to trigger early actions like printing a 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 | Controls whether the valid choices for the parameter are displayed in the help text. |
| show_envvar | bool = True | Controls whether the associated environment variable is displayed in the help text. |
| help | `str | None` = None |
| hidden | bool = False | Whether to hide this parameter from the help output. |
| case_sensitive | bool = True | Whether string comparisons for choices should be case-sensitive. |
| min | `int | float |
| max | `int | float |
| clamp | bool = False | Whether to clamp numeric values to the min/max range 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 | Whether file writes should be performed atomically using a temporary file. |
| exists | bool = False | Whether the provided path must already exist on the filesystem. |
| file_okay | bool = True | Whether a file is a valid value for a Path parameter. |
| dir_okay | bool = True | Whether a directory is a valid value for a Path parameter. |
| 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 (eliminating symlinks and '..'). |
| allow_dash | bool = False | Whether to allow a single dash '-' to represent stdin/stdout. |
| path_type | `None | type[str] |
| rich_help_panel | `str | None` = None |