command_creator.arg

command_creator.arg(help: str = '', abrv: str | None = None, choices: list[str] | type[~enum.Enum] | None = None, metavar: str | None = None, optional: bool = False, positional: bool = False, default: ~typing.Any = <dataclasses._MISSING_TYPE object>, default_factory: ~typing.Callable[[], ~typing.Any] = <function <lambda>>, init: bool = True, repr: bool = True, hash: bool | None = None, count: bool = False, compare: bool = True, completer: ~typing.Callable[[~typing.Unpack[~command_creator.CompleterArgs]], ~typing.List[str] | ~typing.Dict[str, str]] | ~typing.Dict[str, str] | ~typing.List[str] | None = None, metadata: ~typing.Mapping[~typing.Any, ~typing.Any] = {}, **kwargs: ~typing.Any) Any

Create a command-line argument

Parameters:
  • help (str, optional) – Help message for the argument. Defaults to empty string.

  • abrv (str | None, optional) – Abbreviation for the argument. Defaults to None.

  • choices (list[str] | Enum | None, optional) – List of choices for the argument. Defaults to None.

  • metavar (str | None) – The metavar to use when displaying argument help info. Defaults to None.

  • optional (bool, optional) – Whether the argument is optional. Default to False.

  • positional (bool, optional) – Whether the argument is positional. Defaults to False.

  • default (Any, optional) – Default value for the argument. Defaults to MISSING.

  • default_factory (Callable[[], Any], optional) – Default factory for the argument. Defaults to lambda: MISSING.

  • init (bool, optional) – Whether the argument is included in the __init__ method. Defaults to True.

  • repr (bool, optional) – Whether the argument is included in the __repr__ method. Defaults to True.

  • hash (bool | None, optional) – Whether the argument is included in the __hash__ method. Defaults to None.

  • count (bool, optional) – Whether the argument should be a count of the times it appears Defaults to False.

  • compare (bool, optional) – Whether the argument is included in the __eq__ method. Defaults to True.

  • completer (Completer | None) – A completer which can be used for argcomplete. Defaults to None.

  • metadata (Mapping[Any, Any], optional) – Metadata for the argument. Defaults to dict().

  • **kwargs (Any) – Additional keyword arguments for the argument.

Returns:

The command-line argument

Return type:

Any