|
CPP-AP 3.0.1
Command-line argument parser for C++20
|
Namespaces | |
| namespace | action |
| namespace | action_type |
| namespace | detail |
| namespace | nargs |
| namespace | util |
Classes | |
| class | argument |
| Represents a command-line argument, either positional or optional. More... | |
| class | argument_group |
| Represents a group of arguments. More... | |
| class | argument_parser |
| The main argument parser class. More... | |
| struct | argument_parser_exception |
| Base type for the argument parser functionality errors/exceptions. More... | |
| struct | invalid_configuration |
| Exception type used for invalid configuration of an argument parser or its arguments. More... | |
| struct | lookup_failure |
| Exception type used for element lookup errors. More... | |
| struct | none_type |
| A type representing the absence of a value. This type is used for arguments that should not store any values or as a fallback type for conditionally defined types. More... | |
| struct | parsing_failure |
| Exception type used for errors encountered during the argument parsing operation. More... | |
| struct | type_error |
| Exception type used for type-related errors. More... | |
| struct | version |
| A helper structure used to represent a program's version. More... | |
Typedefs | |
| template<util::c_argument_value_type T = std::string> | |
| using | positional_argument = argument< argument_type::positional, T > |
| Positional argument alias. | |
| template<util::c_argument_value_type T = std::string> | |
| using | optional_argument = argument< argument_type::optional, T > |
| Optional argument alias. | |
Enumerations | |
| enum class | argument_type : bool { positional , optional } |
| A discriminator type used to specify the type of an argument within the ap::argument class. More... | |
| enum class | default_argument : std::uint8_t { p_input , p_output , o_help , o_version , o_input , o_output , o_multi_input , o_multi_output } |
| The enumeration of default arguments provided by the library. More... | |
| enum class | unknown_policy : std::uint8_t { fail , warn , ignore , as_values } |
| The enumeration of policies for handling unknown arguments. More... | |
Functions | |
| std::ostream & | operator<< (std::ostream &os, const argument_parser &) noexcept |
| using ap::optional_argument = typedef argument<argument_type::optional, T> |
Optional argument alias.
| T | The value type accepted by the argument (defaults to std::string). |
Definition at line 776 of file argument.hpp.
| using ap::positional_argument = typedef argument<argument_type::positional, T> |
Positional argument alias.
| T | The value type accepted by the argument (defaults to std::string). |
Definition at line 768 of file argument.hpp.
|
strong |
A discriminator type used to specify the type of an argument within the ap::argument class.
| Enumerator | |
|---|---|
| positional | |
| optional | |
Definition at line 29 of file argument.hpp.
|
strong |
The enumeration of default arguments provided by the library.
| Enumerator | |
|---|---|
| p_input | A positional argument representing a single input file path. Equivalent to: parser.add_positional_argument("input")
.help("Input file path");
util::callable_type< ap::action_type::observe, std::string > check_file_exists() noexcept Returns an observe action which checks whether lower_bound file with the given name exists. Definition predefined.hpp:41 |
| p_output | A positional argument representing a single output file path. Equivalent to: parser.add_positional_argument("output")
.help("Output file path");
|
| o_help | An optional argument representing the program's help flag. Equivalent to: parser.add_optional_argument<ap::none_type>("help")
.action<ap::action_type::on_flag>(ap::action::print_help(parser, EXIT_SUCCESS))
.help("Display the help message");
ap::action_type::on_flag::type print_help(const argument_parser &parser, const std::optional< int > exit_code=std::nullopt, std::ostream &os=std::cout) noexcept Returns an on-flag action which prints the argument parser's help message. Definition predefined.hpp:28 A type representing the absence of a value. This type is used for arguments that should not store any... Definition types.hpp:20 |
| o_version | An optional argument representing the program's version flag. Equivalent to: .action<action_type::on_flag>([&arg_parser]() {
arg_parser.print_version();
std::exit(EXIT_SUCCESS);
})
.help("Dsiplay program version info");
|
| o_input | A positional argument representing multiple input file paths. Equivalent to: parser.add_positional_argument("input", "i")
.nargs(1ull)
.help("Input file path");
|
| o_output | A positional argument representing multiple output file paths. Equivalent to: parser.add_positional_argument("output", "o")
.nargs(1ull)
.help("Output file path");
|
| o_multi_input | A positional argument representing multiple input file paths. Equivalent to: parser.add_positional_argument("input", "i")
.nargs(ap::nargs::at_least(1ull))
.help("Input file path");
constexpr range at_least(const count_type n) noexcept range class builder function. Creates a range [n, inf). Definition range.hpp:128 |
| o_multi_output | A positional argument representing multiple output file paths. Equivalent to: parser.add_positional_argument("output", "o")
.nargs(ap::nargs::at_least(1ull))
.help("Output file path");
|
Definition at line 36 of file argument_parser.hpp.
|
strong |
The enumeration of policies for handling unknown arguments.
Definition at line 131 of file argument_parser.hpp.
|
noexcept |
An os << parser operation is equivalent to a parser.print_help(_verbose, os) call, where _verbose is the inner verbosity mode, which can be set with the verbose function.
| os | The output stream. |
| parser | The argument parser to print. |
Definition at line 891 of file argument_parser.hpp.