Skip to content

Arg

APIDescription
idSet the identifier used for referencing this argument in the clap API.
shortSets the short version of the argument without the preceding -.
longSets the long version of the argument without the preceding --.
aliasAdd an alias, which functions as a hidden long flag.
short_aliasAdd an alias, which functions as a hidden short flag.
aliasesAdd aliases, which function as hidden long flags.
short_aliasesAdd aliases, which functions as a hidden short flag.
visible_aliasAdd an alias, which functions as a visible long flag.
visible_short_aliasAdd an alias, which functions as a visible short flag.
visible_aliasesAdd aliases, which function as visible long flags.
visible_short_aliasesAdd aliases, which function as visible short flags.
indexSpecifies the index of a positional argument starting at 1.
trailing_var_argThis is a “var arg” and everything that follows should be captured by it, as if the user had used a --.
lastThis arg is the last, or final, positional argument (i.e. has the highest index) and is only able to be accessed via the -- syntax (i.e. $ prog args -- last_arg).
requiredSpecifies that the argument must be present.
requiresSets an argument that is required when this one is present.
exclusiveThis argument must be passed alone; it conflicts with all other arguments.
globalSpecifies that an argument can be matched to all child Subcommands.
actionSpecify how to react to an argument when parsing it.
value_parserSpecify the typed behavior of the argument.
num_argsSpecifies the number of arguments parsed per occurrence.
value_namePlaceholder for the argument’s value in the help message / usage.
value_namesPlaceholders for the argument’s values in the help message / usage.
value_hintProvide the shell a hint about how to complete this argument.
ignore_caseMatch values against PossibleValuesParser without matching case.
allow_hyphen_valuesAllows values which start with a leading hyphen (-)
allow_negative_numbersAllows negative numbers to pass as values.
require_equalsRequires that options use the --option=val syntax
value_delimiterAllow grouping of multiple values via a delimiter.
value_terminatorSentinel to stop parsing multiple values of a given argument.
rawConsume all following arguments.
default_valueValue for the argument when not present.
default_valuesValue for the argument when not present.
default_missing_valueValue for the argument when the flag is present but no value is specified.
default_missing_value_osValue for the argument when the flag is present but no value is specified.
default_missing_valuesValue for the argument when the flag is present but no value is specified.
default_missing_values_osValue for the argument when the flag is present but no value is specified.
envRead from name environment variable when argument is not present.
helpSets the description of the argument for short help (-h).
long_helpSets the description of the argument for long help (--help).
display_orderAllows custom ordering of args within the help message.
help_headingOverride the current help section.
next_line_helpRender the help on the line after the argument.
hideHide this argument from the generated help text.
hide_possible_valuesDo not display the possible values in the help message.
hide_default_valueDo not display the default value of the argument in the help message.
hide_envDo not display in help the environment variable name.
hide_env_valuesDo not display in help any values inside the associated ENV variables for the argument.
hide_short_helpHides an argument from short help (-h).
hide_long_helpHides an argument from long help (--help).
groupThe name of the ArgGroup the argument belongs to.
groupsThe names of ArgGroup’s the argument belongs to.
default_value_ifSpecifies the value of the argument if arg has been used at runtime.
default_value_ifsSpecifies multiple values and conditions in the same manner as default_value_if.
required_unless_presentSet this arg as required as long as the specified argument is not present at runtime.
required_unless_present_allSets this arg as required unless all of the specified arguments are present at runtime.
required_unless_present_anySets this arg as required unless any of the specified arguments are present at runtime.
required_if_eqThis argument is required only if the specified arg is present at runtime and its value equals val.
required_if_eq_anySpecify this argument is required based on multiple conditions.
required_if_eq_allSpecify this argument is required based on multiple conditions.
requires_ifRequire another argument if this arg matches the ArgPredicate.
requires_ifsAllows multiple conditional requirements.
conflicts_withThis argument is mutually exclusive with the specified argument.
conflicts_with_allThis argument is mutually exclusive with the specified arguments.
overrides_withSets an overridable argument.
overrides_with_allSets multiple mutually overridable arguments by name.