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

Method _find_subcommand

simcore/framework/src/cli/cli.hpp:6987–7001  ·  view source on GitHub ↗

Locate a subcommand by name with two conditions, should disabled subcommands be ignored, and should used subcommands be ignored

Source from the content-addressed store, hash-verified

6985 /// Locate a subcommand by name with two conditions, should disabled subcommands be ignored, and should used
6986 /// subcommands be ignored
6987 App *_find_subcommand(const std::string &subc_name, bool ignore_disabled, bool ignore_used) const noexcept {
6988 for (const App_p &com : subcommands_) {
6989 if (com->disabled_ && ignore_disabled) continue;
6990 if (com->get_name().empty()) {
6991 auto subc = com->_find_subcommand(subc_name, ignore_disabled, ignore_used);
6992 if (subc != nullptr) {
6993 return subc;
6994 }
6995 }
6996 if (com->check_name(subc_name)) {
6997 if ((!*com) || !ignore_used) return com.get();
6998 }
6999 }
7000 return nullptr;
7001 }
7002
7003 /// Parse a subcommand, modify args and continue
7004 ///

Callers 1

_parse_positionalMethod · 0.80

Calls 4

emptyMethod · 0.45
get_nameMethod · 0.45
check_nameMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected