| 9 | #include <string> |
| 10 | |
| 11 | int main(int argc, char **argv) { |
| 12 | |
| 13 | CLI::App app("K3Pi goofit fitter"); |
| 14 | app.set_help_all_flag("--help-all", "Expand all help"); |
| 15 | app.add_flag("--random", "Some random flag"); |
| 16 | CLI::App *start = app.add_subcommand("start", "A great subcommand"); |
| 17 | CLI::App *stop = app.add_subcommand("stop", "Do you really want to stop?"); |
| 18 | app.require_subcommand(); // 1 or more |
| 19 | |
| 20 | std::string file; |
| 21 | start->add_option("-f,--file", file, "File name"); |
| 22 | |
| 23 | CLI::Option *s = stop->add_flag("-c,--count", "Counter"); |
| 24 | |
| 25 | CLI11_PARSE(app, argc, argv); |
| 26 | |
| 27 | std::cout << "Working on --file from start: " << file << '\n'; |
| 28 | std::cout << "Working on --count from stop: " << s->count() << ", direct count: " << stop->count("--count") << '\n'; |
| 29 | std::cout << "Count of --random flag: " << app.count("--random") << '\n'; |
| 30 | for(auto *subcom : app.get_subcommands()) |
| 31 | std::cout << "Subcommand: " << subcom->get_name() << '\n'; |
| 32 | |
| 33 | return 0; |
| 34 | } |
nothing calls this directly
no test coverage detected