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

Method remove_subcommand

simcore/framework/src/cli/cli.hpp:5505–5519  ·  view source on GitHub ↗

Removes a subcommand from the App. Takes a subcommand pointer. Returns true if found and removed.

Source from the content-addressed store, hash-verified

5503
5504 /// Removes a subcommand from the App. Takes a subcommand pointer. Returns true if found and removed.
5505 bool remove_subcommand(App *subcom) {
5506 // Make sure no links exist
5507 for (App_p &sub : subcommands_) {
5508 sub->remove_excludes(subcom);
5509 sub->remove_needs(subcom);
5510 }
5511
5512 auto iterator = std::find_if(std::begin(subcommands_), std::end(subcommands_),
5513 [subcom](const App_p &v) { return v.get() == subcom; });
5514 if (iterator != std::end(subcommands_)) {
5515 subcommands_.erase(iterator);
5516 return true;
5517 }
5518 return false;
5519 }
5520 /// Check to see if a subcommand is part of this command (doesn't have to be in command line)
5521 /// returns the first subcommand if passed a nullptr
5522 App *get_subcommand(const App *subcom) const {

Callers 1

add_subcommandMethod · 0.80

Calls 6

beginFunction · 0.85
endFunction · 0.85
remove_excludesMethod · 0.45
remove_needsMethod · 0.45
getMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected