MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / _parse_subcommand

Method _parse_subcommand

simcore/framework/src/cli/cli.hpp:7007–7028  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 1

parse_subcommandMethod · 0.80

Calls 6

HorribleErrorClass · 0.85
backMethod · 0.80
_parseMethod · 0.80
_trigger_pre_parseMethod · 0.80
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected