ark::core::PositionalRule

Defined in header “ark/core/argument_parser.hh”.


Represents a positional rule. These don’t have flags, can appear only once, but can take one or more arguments. They are parsed in order.

These are the rules that the command line options are parsed from, and are normally instantiated and managed by the ArgumentParser itself.

Methods

  • PositionalRule(std::string name)
    Constructor. Initializes a new positional rule with the given name.

  • ~PositionalRule()
    Virtual destructor, for cleanup.

  • PositionalRule & consume_remaining_arguments()
    Set if this positional consumes a value or not. Options can consume either no values (the default) or one value.

  • PositionalRule & required()
    Indicates this positional is required to be specified.

  • PositionalRule & help(std::string text)
    Sets help text for this item.

  • bool has_name(const std::string_view & name)
    Returns true if this rule has the given name.

  • bool is_required()
    Returns true if this rule is required.