| 9 | #include <string> |
| 10 | |
| 11 | int main(int argc, char **argv) { |
| 12 | CLI::App test{R"raw(Modify the help print so that argument values are accessible. |
| 13 | Note that this will not shortcut `->required` and other similar options.)raw"}; |
| 14 | |
| 15 | // Remove help flag because it shortcuts all processing |
| 16 | test.set_help_flag(); |
| 17 | |
| 18 | // Add custom flag that activates help |
| 19 | auto *help = test.add_flag("-h,--help", "Request help"); |
| 20 | |
| 21 | std::string some_option; |
| 22 | test.add_option("-a", some_option, "Some description"); |
| 23 | |
| 24 | try { |
| 25 | test.parse(argc, argv); |
| 26 | if(*help) |
| 27 | throw CLI::CallForHelp(); |
| 28 | } catch(const CLI::Error &e) { |
| 29 | std::cout << "Option -a string in help: " << some_option << '\n'; |
| 30 | return test.exit(e); |
| 31 | } |
| 32 | |
| 33 | std::cout << "Option -a string: " << some_option << '\n'; |
| 34 | return 0; |
| 35 | } |
nothing calls this directly
no test coverage detected