template<typename OptionsParser, typename... SubCommands>
class fcppt::options::commands< OptionsParser, SubCommands >
A parser for multiple sub commands.
A commands parser parses multiple sub commands. Each sub command consists of a parser and a name, i.e. (name_1, parser_1), ..., (name_n, parser_n). The parser first searches for the first argument, ignoring all option names from OptionsParser. If none is found, the parser fails. Otherwise, the first argument is arg, which is then compared to name_1, ..., name_n. If none of these is equal to arg, the parser fails. Otherwise, let arg = name_i, then the OptionsParser is used to parse everything up to the first argument, and parser_i is used to parse everything after.
- Warning
- Be careful not to include anything other than options or flags in OptionsParser, because otherwise this may lead to very confusing results.
- Template Parameters
-
| OptionsParser | A parser that should only parse options. |
template<typename OptionsParser, typename... SubCommands>
template<typename OptionsParserArg, typename... SubCommandsArgs>
requires (std::conjunction_v< std::is_same<OptionsParser, std::remove_cvref_t<OptionsParserArg>>, std::is_same<SubCommands, std::remove_cvref_t<SubCommandsArgs>>...>)
Constructs a commands parser.
- Template Parameters
-
| OptionsParserArg | A cv-ref to OptionsParser |
| SubCommandsArgs | Cv-refs to SubCommands |