argparse documentation Help

...HelpInfo

There are few structs that describe help information for argument parsing entities.

ArgumentHelpInfo

ArgumentHelpInfo contains data that is needed to print help for an command line argument:

  • const string[] names - all short and long names of an argument prefixed with Config.shortNamePrefix or Config.shortNamePrefix respectively.

  • string description - description of an argument.

  • string placeholder - value placeholder (eg. VALUE for --foo VALUE argument).

  • bool multipleOccurrence - flag denoting that an argument can appear multiple times in command line.

  • bool optionalValue - flag denoting that the value is optional for argument.

  • bool optionalArgument - flag denoting that an argument itself is optional.

  • bool positional - flag denoting that an argument is positional (otherwise, it's named argument).

  • bool hidden - flag denoting that an argument should be hidden from help screen.

  • bool booleanFlag - flag denoting that an argument is a boolean flag.

ArgumentGroupHelpInfo

ArgumentGroupHelpInfo contains information about arguments group:

  • string name - name of the group.

  • string description - group description.

  • const size_t[] argIndex - indexes of arguments that belong to this group. Arguments themselves are store in CommandHelpInfo.

SubCommandHelpInfo

SubCommandHelpInfo contains information about subcommand:

  • const string[] names - subcommand names.

  • string description - subcommand description.

CommandHelpInfo

CommandHelpInfo contains information about subcommand:

  • string name - command name.

  • string usage - command usage.

  • string description - command description.

  • string epilog - command epilog.

  • ArgumentHelpInfo[] arguments - all arguments of the command.

  • ArgumentGroupHelpInfo requiredGroup - group of required arguments of the command.

  • ArgumentGroupHelpInfo optionalGroup - group of optional arguments of the command.

  • ArgumentGroupHelpInfo[] userGroups - user-defined groups of arguments of the command.

  • SubCommandHelpInfo[] subCommands - subcommands.

This struct also has the following helpers to iterate over positional or named arguments only - the both return filtered range of arguments (ArgumentHelpInfo objects):

  • auto positionalArguments() const

  • auto namedArguments() const

Last modified: 11 January 2026