Skip to content

Command

APIDescription
argsAdds multiple arguments to the list of valid possibilities.
groupsAdds multiple ArgGroups to the Command at once.
subcommandsAdds multiple subcommands to the list of valid possibilities.
no_binary_nameSpecifies that the parser should not assume the first argument passed is the binary name.
ignore_errorsTry not to fail on parse errors, like missing option values.
args_override_selfReplace prior occurrences of arguments rather than error.
dont_delimit_trailing_valuesDisables the automatic delimiting of values after -- or when Arg::trailing_var_arg was used.
colorSets when to color output.
stylesSets the Styles for terminal output.
term_widthSets the terminal width at which to wrap help messages.
max_term_widthLimit the line length for wrapping help when using the current terminal’s width.
disable_version_flagDisables -V and —version flag.
propagate_versionSpecifies to use the version of the current command for all subcommands.
next_line_helpPlaces the help string for all arguments and subcommands on the line after them.
disable_help_flagDisables -h and --help flag.
disable_help_subcommandDisables the help subcommand.
disable_colored_helpDisables colorized help messages.
help_expectedPanic if help descriptions are omitted.
hide_possible_valuesTells clap not to print possible values when displaying help information.
infer_long_argsAllow partial matches of long arguments or their aliases.
infer_subcommandsAllow partial matches of subcommand names and their aliases.
nameSets the program’s name.
bin_nameOverrides the runtime-determined name of the binary for help and error messages.
display_nameOverrides the runtime-determined display name of the program for help and error messages.
authorSets the author(s) for the help message.
aboutSets the program’s description for the short help (-h).
long_aboutSets the program’s description for the long help (--help).
after_helpFree-form help text for after auto-generated short help (-h).
after_long_helpFree-form help text for after auto-generated long help (--help).
before_helpFree-form help text for before auto-generated short help (-h).
before_long_helpFree-form help text for before auto-generated long help (--help).
versionSets the version for the short version (-V) and help messages.
long_versionSets the version for the long version (--version) and help messages.
override_usageOverrides the clap generated usage string for help and error messages.
override_helpOverrides the clap generated help message (both -h and --help).
help_templateSets the help template to be used, overriding the default format.
flatten_helpFlatten subcommand help into the current command’s help.
next_help_headingSet the default section heading for future args.
next_display_orderChange the starting value for assigning future display orders for args.
arg_required_else_helpExit gracefully if no arguments are present (e.g. $ myprog).
allow_missing_positionalAllows one to implement two styles of CLIs where positionals can be used out of order.
short_flagSets the short version of the subcommand flag without the preceding -.
long_flagSets the long version of the subcommand flag without the preceding --.
aliasSets a hidden alias to this subcommand.
short_flag_aliasAdd an alias, which functions as “hidden” short flag subcommand.
long_flag_aliasAdd an alias, which functions as a “hidden” long flag subcommand.
aliasesSets multiple hidden aliases to this subcommand.
short_flag_aliasesAdd aliases, which function as “hidden” short flag subcommands.
long_flag_aliasesAdd aliases, which function as “hidden” long flag subcommands.
visible_aliasSets a visible alias to this subcommand.
visible_short_flag_aliasAdd an alias, which functions as “visible” short flag subcommand.
visible_long_flag_aliasAdd an alias, which functions as a “visible” long flag subcommand.
visible_aliasesSets multiple visible aliases to this subcommand.
visible_short_flag_aliasesAdd aliases, which function as visible short flag subcommands.
visible_long_flag_aliasesAdd aliases, which function as visible long flag subcommands.
display_orderSet the placement of this subcommand within the help.
hideSpecifies that this subcommand should be hidden from help messages.
subcommand_requiredIf no subcommand is present at runtime, error and exit gracefully.
allow_external_subcommandsAssume unexpected positional arguments are a subcommand.
external_subcommand_value_parserSpecifies how to parse external subcommand arguments.
args_conflicts_with_subcommandsSpecifies that use of an argument prevents the use of subcommands.
subcommand_precedence_over_argPrevent subcommands from being consumed as an arguments value.
subcommand_negates_reqsAllows subcommands to override all requirements of the parent command.
multicallMultiple-personality program dispatched on the binary name (argv[0]).
subcommand_value_nameSets the value name used for subcommands when printing usage and help.
subcommand_help_headingSets the help heading used for subcommands when printing usage and help.