Locate a subcommand by name with two conditions, should disabled subcommands be ignored, and should used subcommands be ignored
| 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 | /// |
no test coverage detected