| 966 | } |
| 967 | |
| 968 | struct SubcommandProgram : public TApp { |
| 969 | |
| 970 | CLI::App *start{nullptr}; |
| 971 | CLI::App *stop{nullptr}; |
| 972 | |
| 973 | int dummy{0}; |
| 974 | std::string file{}; |
| 975 | int count{0}; |
| 976 | |
| 977 | SubcommandProgram(const SubcommandProgram &) = delete; |
| 978 | SubcommandProgram &operator=(const SubcommandProgram &) = delete; |
| 979 | |
| 980 | SubcommandProgram() { |
| 981 | app.set_help_all_flag("--help-all"); |
| 982 | |
| 983 | start = app.add_subcommand("start", "Start prog"); |
| 984 | stop = app.add_subcommand("stop", "Stop prog"); |
| 985 | |
| 986 | app.add_flag("-d", dummy, "My dummy var"); |
| 987 | start->add_option("-f,--file", file, "File name"); |
| 988 | stop->add_flag("-c,--count", count, "Some flag opt"); |
| 989 | } |
| 990 | }; |
| 991 | |
| 992 | TEST_CASE_METHOD(SubcommandProgram, "Subcommand Working", "[subcom]") { |
| 993 | args = {"-d", "start", "-ffilename"}; |
nothing calls this directly
no outgoing calls
no test coverage detected