Skip to main content

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

AttributeTypeDescription
default`AnyNone` = None
param_decls`Sequence[str]None` = None
callback`Callable[..., Any]None` = None
metavar`strNone` = None
expose_valuebool = trueDetermines whether the parameter value is passed to the command function.
is_eagerbool = falseIf true, this parameter is processed before others to trigger early actions like printing version info.
envvar`strlist[str]
shell_complete`CallableNone` = None
autocompletion`Callable[..., Any]None` = None
default_factory`Callable[[], Any]None` = None
parser`Callable[[str], Any]None` = None
click_type`click.ParamTypeNone` = None
show_default`boolstr` = true
show_choicesbool = trueDetermines if the valid choices for the parameter should be shown in the help text.
show_envvarbool = trueDetermines if the associated environment variable should be shown in the help text.
help`strNone` = None
hiddenbool = falseIf true, the parameter will be functional but omitted from the help output.
case_sensitivebool = trueDetermines if string comparisons for choices should respect character casing.
min`intfloat
max`intfloat
clampbool = falseIf 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`strNone` = None
encoding`strNone` = None
errors`strNone` = "strict"
lazy`boolNone` = None
atomicbool = falseIf true, file writes are performed to a temporary file and moved to the destination atomically on close.
existsbool = falseIf true, the provided path must already exist on the filesystem.
file_okaybool = trueDetermines if the path parameter is allowed to be a file.
dir_okaybool = trueDetermines if the path parameter is allowed to be a directory.
writablebool = falseIf true, the path must have write permissions for the user.
readablebool = trueIf true, the path must have read permissions for the user.
resolve_pathbool = falseIf true, the path will be converted to an absolute path with symlinks resolved.
allow_dashbool = falseIf true, allows a single dash '-' to represent standard input or output.
path_type`Nonetype[str]
rich_help_panel`strNone` = 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

NameTypeDescription
default`AnyNone` = None
param_decls`Sequence[str]None` = None
callback`Callable[..., Any]None` = None
metavar`strNone` = None
expose_valuebool = TrueWhether to pass the value to the command function.
is_eagerbool = FalseWhether to process this parameter before others.
envvar`strlist[str]
shell_complete`CallableNone` = None
autocompletion`Callable[..., Any]None` = None
default_factory`Callable[[], Any]None` = None
parser`Callable[[str], Any]None` = None
click_type`click.ParamTypeNone` = None
show_default`boolstr` = True
show_choicesbool = TrueWhether to show valid choices in help text.
show_envvarbool = TrueWhether to show the environment variable in help text.
help`strNone` = None
hiddenbool = FalseWhether to hide the parameter from help output.
case_sensitivebool = TrueWhether string choices are case sensitive.
min`intfloat
max`intfloat
clampbool = FalseWhether to clamp numeric values to the min/max range.
formats`list[str]None` = None
mode`strNone` = None
encoding`strNone` = None
errors`strNone` = "strict"
lazy`boolNone` = None
atomicbool = FalseWhether file writes should be atomic.
existsbool = FalseWhether the path must exist.
file_okaybool = TrueWhether files are allowed as paths.
dir_okaybool = TrueWhether directories are allowed as paths.
writablebool = FalseWhether the path must be writable.
readablebool = TrueWhether the path must be readable.
resolve_pathbool = FalseWhether to resolve the path to an absolute path.
allow_dashbool = FalseWhether to allow '-' as a path for stdin/stdout.
path_type`Nonetype[str]
rich_help_panel`strNone` = 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

NameTypeDescription
default`AnyNone` = None
param_decls`Sequence[str]None` = None
callback`Callable[..., Any]None` = None
metavar`strNone` = None
expose_valuebool = TrueWhether the parameter value should be passed to the command function.
is_eagerbool = FalseWhether this parameter should be processed before others to trigger early actions like printing a version.
envvar`strlist[str]
shell_complete`CallableNone` = None
autocompletion`Callable[..., Any]None` = None
default_factory`Callable[[], Any]None` = None
parser`Callable[[str], Any]None` = None
click_type`click.ParamTypeNone` = None
show_default`boolstr` = True
show_choicesbool = TrueControls whether the valid choices for the parameter are displayed in the help text.
show_envvarbool = TrueControls whether the associated environment variable is displayed in the help text.
help`strNone` = None
hiddenbool = FalseWhether to hide this parameter from the help output.
case_sensitivebool = TrueWhether string comparisons for choices should be case-sensitive.
min`intfloat
max`intfloat
clampbool = FalseWhether to clamp numeric values to the min/max range instead of raising an error.
formats`list[str]None` = None
mode`strNone` = None
encoding`strNone` = None
errors`strNone` = "strict"
lazy`boolNone` = None
atomicbool = FalseWhether file writes should be performed atomically using a temporary file.
existsbool = FalseWhether the provided path must already exist on the filesystem.
file_okaybool = TrueWhether a file is a valid value for a Path parameter.
dir_okaybool = TrueWhether a directory is a valid value for a Path parameter.
writablebool = FalseWhether the path must be writable.
readablebool = TrueWhether the path must be readable.
resolve_pathbool = FalseWhether to resolve the path to an absolute path (eliminating symlinks and '..').
allow_dashbool = FalseWhether to allow a single dash '-' to represent stdin/stdout.
path_type`Nonetype[str]
rich_help_panel`strNone` = None