MCPcopy Create free account
hub / github.com/CLIUtils/CLI11 / SubcommandProgram

Class SubcommandProgram

tests/SubcommandTest.cpp:968–990  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

966}
967
968struct 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
992TEST_CASE_METHOD(SubcommandProgram, "Subcommand Working", "[subcom]") {
993 args = {"-d", "start", "-ffilename"};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected