Parse a subcommand, modify args and continue Unlike the others, this one will always allow fallthrough return true if the subcommand was processed false otherwise
| 7005 | /// Unlike the others, this one will always allow fallthrough |
| 7006 | /// return true if the subcommand was processed false otherwise |
| 7007 | bool _parse_subcommand(std::vector<std::string> &args) { |
| 7008 | if (_count_remaining_positionals(/* required */ true) > 0) { |
| 7009 | _parse_positional(args, false); |
| 7010 | return true; |
| 7011 | } |
| 7012 | auto com = _find_subcommand(args.back(), true, true); |
| 7013 | if (com != nullptr) { |
| 7014 | args.pop_back(); |
| 7015 | parsed_subcommands_.push_back(com); |
| 7016 | com->_parse(args); |
| 7017 | auto parent_app = com->parent_; |
| 7018 | while (parent_app != this) { |
| 7019 | parent_app->_trigger_pre_parse(args.size()); |
| 7020 | parent_app->parsed_subcommands_.push_back(com); |
| 7021 | parent_app = parent_app->parent_; |
| 7022 | } |
| 7023 | return true; |
| 7024 | } |
| 7025 | |
| 7026 | if (parent_ == nullptr) throw HorribleError("Subcommand " + args.back() + " missing"); |
| 7027 | return false; |
| 7028 | } |
| 7029 | |
| 7030 | /// Parse a short (false) or long (true) argument, must be at the top of the list |
| 7031 | /// return true if the argument was processed or false if nothing was done |
no test coverage detected