Internal function to run (App) callback, bottom up
| 6361 | } |
| 6362 | /// Internal function to run (App) callback, bottom up |
| 6363 | void run_callback(bool final_mode = false) { |
| 6364 | pre_callback(); |
| 6365 | // in the main app if immediate_callback_ is set it runs the main callback before the used subcommands |
| 6366 | if (!final_mode && parse_complete_callback_) { |
| 6367 | parse_complete_callback_(); |
| 6368 | } |
| 6369 | // run the callbacks for the received subcommands |
| 6370 | for (App *subc : get_subcommands()) { |
| 6371 | subc->run_callback(true); |
| 6372 | } |
| 6373 | // now run callbacks for option_groups |
| 6374 | for (auto &subc : subcommands_) { |
| 6375 | if (subc->name_.empty() && subc->count_all() > 0) { |
| 6376 | subc->run_callback(true); |
| 6377 | } |
| 6378 | } |
| 6379 | |
| 6380 | // finally run the main callback |
| 6381 | if (final_callback_ && (parsed_ > 0)) { |
| 6382 | if (!name_.empty() || count_all() > 0) { |
| 6383 | final_callback_(); |
| 6384 | } |
| 6385 | } |
| 6386 | } |
| 6387 | |
| 6388 | /// Check to see if a subcommand is valid. Give up immediately if subcommand max has been reached. |
| 6389 | bool _valid_subcommand(const std::string ¤t, bool ignore_used = true) const { |
no test coverage detected