args
6.2.0
A simple single-header C++11 STL-only argument parser library
|
contains all the functionality of the args library More...
Classes | |
class | Error |
Base error class. More... | |
class | UsageError |
Errors that occur during usage. More... | |
class | ParseError |
Errors that occur during regular parsing. More... | |
class | ValidationError |
Errors that are detected from group validation after parsing finishes. More... | |
class | RequiredError |
Errors that when a required flag is omitted. More... | |
class | MapError |
Errors in map lookups. More... | |
class | ExtraError |
Error that occurs when a singular flag is specified multiple times. More... | |
class | Help |
An exception that indicates that the user has requested help. More... | |
class | SubparserError |
(INTERNAL) An exception that emulates coroutine-like control flow for subparsers. | |
class | Completion |
An exception that contains autocompletion reply. More... | |
struct | EitherFlag |
A simple unified option type for unified initializer lists for the Matcher class. More... | |
class | Matcher |
A class of "matchers", specifying short and flags that can possibly be matched. More... | |
struct | HelpParams |
A simple structure of parameters for easy user-modifyable help menus. More... | |
struct | Nargs |
A number of arguments which can be consumed by an option. More... | |
class | Base |
Base class for all match types. More... | |
class | NamedBase |
Base class for all match types that have a name. More... | |
class | FlagBase |
Base class for all flag options. More... | |
class | ValueFlagBase |
Base class for value-accepting flag options. More... | |
class | CompletionFlag |
class | PositionalBase |
Base class for positional options. More... | |
class | Group |
Class for all kinds of validating groups, including ArgumentParser. More... | |
class | GlobalOptions |
Class for using global options in ArgumentParser. More... | |
class | Subparser |
Utility class for building subparsers with coroutines/callbacks. More... | |
class | Command |
Main class for building subparsers. More... | |
class | ArgumentParser |
The main user facing command line argument parser class. More... | |
class | Flag |
Boolean argument matcher. More... | |
class | HelpFlag |
Help flag class. More... | |
class | CounterFlag |
A flag class that simply counts the number of times it's matched. More... | |
class | ActionFlag |
A flag class that calls a function when it's matched. More... | |
struct | ValueReader |
A default Reader class for argument classes. More... | |
class | ValueFlag |
An argument-accepting flag class. More... | |
class | ImplicitValueFlag |
An optional argument-accepting flag class. More... | |
class | NargsValueFlag |
A variadic arguments accepting flag class. More... | |
class | ValueFlagList |
An argument-accepting flag class that pushes the found values into a list. More... | |
class | MapFlag |
A mapping value flag class. More... | |
class | MapFlagList |
A mapping value flag list class. More... | |
class | Positional |
A positional argument class. More... | |
class | PositionalList |
A positional argument class that pushes the found values into a list. More... | |
class | MapPositional |
A positional argument mapping class. More... | |
class | MapPositionalList |
A positional argument mapping list class. More... | |
Enumerations | |
enum class | Options { None = 0x0 , Single = 0x01 , Required = 0x02 , HiddenFromUsage = 0x04 , HiddenFromDescription = 0x08 , Global = 0x10 , KickOut = 0x20 , HiddenFromCompletion = 0x40 , Hidden = HiddenFromUsage | HiddenFromDescription | HiddenFromCompletion } |
Attributes for flags. More... | |
Functions | |
template<typename Option > | |
auto | get (Option &option_) -> decltype(option_.Get()) |
Getter to grab the value from the argument type. More... | |
std::string::size_type | Glyphs (const std::string &string_) |
(INTERNAL) Count UTF-8 glyphs More... | |
template<typename It > | |
std::vector< std::string > | Wrap (It begin, It end, const std::string::size_type width, std::string::size_type firstlinewidth=0, std::string::size_type firstlineindent=0) |
(INTERNAL) Wrap a vector of words into a vector of lines More... | |
std::vector< std::string > | Wrap (const std::string &in, const std::string::size_type width, std::string::size_type firstlinewidth=0) |
(INTERNAL) Wrap a string into a vector of lines More... | |
Options | operator| (Options lhs, Options rhs) |
Options | operator& (Options lhs, Options rhs) |
std::ostream & | operator<< (std::ostream &os, const ArgumentParser &parser) |
contains all the functionality of the args library
|
strong |
Attributes for flags.
Enumerator | |
---|---|
None | Default options. |
Single | Flag can't be passed multiple times. |
Required | Flag can't be omitted. |
HiddenFromUsage | Flag is excluded from usage line. |
HiddenFromDescription | Flag is excluded from options help. |
Global | Flag is global and can be used in any subcommand. |
KickOut | Flag stops a parser. |
HiddenFromCompletion | Flag is excluded from auto completion. |
Hidden | Flag is excluded from options help and usage line. |
auto args::get | ( | Option & | option_ | ) | -> decltype(option_.Get()) |
Getter to grab the value from the argument type.
If the Get() function of the type returns a reference, so does this, and the value will be modifiable.
|
inline |
(INTERNAL) Count UTF-8 glyphs
This is not reliable, and will fail for combinatory glyphs, but it's good enough here for now.
string | The string to count glyphs from |
|
inline |
(INTERNAL) Wrap a string into a vector of lines
This is quick and hacky, but works well enough. You can specify a different width for the first line
width | The width of the body |
firstlinewid | the width of the first line, defaults to the width of the body |
|
inline |
(INTERNAL) Wrap a vector of words into a vector of lines
Empty words are skipped. Word "\n" forces wrapping.
begin | The begin iterator |
end | The end iterator |
width | The width of the body |
firstlinewidth | the width of the first line, defaults to the width of the body |
firstlineindent | the indent of the first line, defaults to 0 |