Removes a subcommand from the App. Takes a subcommand pointer. Returns true if found and removed.
| 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 { |
no test coverage detected