Core
clap.core.Arg
dataclass
Arg(
short: Optional[Union[AutoFlag, str]] = None,
long: Optional[Union[AutoFlag, str]] = None,
help: Optional[str] = None,
long_help: Optional[str] = None,
value_name: Optional[str] = None,
aliases: Sequence[str] = list(),
ty: Optional[Base] = None,
group: Optional[Group] = None,
action: Optional[Union[ArgAction, type]] = None,
num_args: Optional[NargsType] = None,
default_missing_value: Optional[Any] = None,
default_value: Optional[Any] = None,
choices: Optional[Sequence[str]] = None,
choices_help: Optional[dict[str, str]] = None,
required: Optional[bool] = None,
deprecated: Optional[bool] = None,
dest: Optional[str] = None,
extend_default: Optional[Any] = None,
)
Attributes:
-
aliases(Sequence[str]) –Flags in addition to
shortandlong. -
extend_default(Optional[Any]) –argparse has a "bug" where the values get appended to the default value
-
group(Optional[Group]) –The group containing the argument.
-
long(Optional[Union[AutoFlag, str]]) –The long flag.
-
short(Optional[Union[AutoFlag, str]]) –The short flag.
-
ty(Optional[Base]) –Stores type information for the argument.
aliases
class-attribute
instance-attribute
Flags in addition to short and long.
extend_default
class-attribute
instance-attribute
argparse has a "bug" where the values get appended to the default value list if the extend action is used. This is a workaround for that.
group
class-attribute
instance-attribute
The group containing the argument.
short
class-attribute
instance-attribute
The short flag.
ty
class-attribute
instance-attribute
ty: Optional[Base] = None
Stores type information for the argument.
clap.core.AutoFlag
Bases: Enum
Attributes:
clap.core.Command
dataclass
Command(
name: str,
aliases: Sequence[str] = list(),
usage: Optional[str] = None,
author: Optional[str] = None,
version: Optional[str] = None,
long_version: Optional[str] = None,
about: Optional[str] = None,
long_about: Optional[str] = None,
before_help: Optional[str] = None,
before_long_help: Optional[str] = None,
after_help: Optional[str] = None,
after_long_help: Optional[str] = None,
subcommand_help_heading: str = "Commands",
subcommand_value_name: str = "COMMAND",
color: Optional[ColorChoice] = None,
styles: Optional[Styles] = None,
help_template: Optional[str] = None,
max_term_width: Optional[int] = None,
propagate_version: bool = False,
disable_version_flag: bool = False,
disable_help_flag: bool = False,
prefix_chars: str = "-",
fromfile_prefix_chars: Optional[str] = None,
conflict_handler: Optional[str] = None,
allow_abbrev: Optional[bool] = None,
exit_on_error: Optional[bool] = None,
deprecated: Optional[bool] = None,
field_to_arg: dict[str, Arg] = dict(),
field_to_group_cls: dict[str, type] = dict(),
group_to_args: dict[Group, list[Arg]] = dict(),
subcommand_class: Optional[type] = None,
subcommands: dict[str, Self] = dict(),
subcommand_dest: Optional[str] = None,
subparser_dest: Optional[str] = None,
subcommand_required: bool = False,
)
Attributes:
-
subcommand_class(Optional[type]) –Contains the class if it is a subcommand.