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

Function main

examples/nested.cpp:11–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include <string>
10
11int main(int argc, char **argv) {
12
13 CLI::App app("Vision Application");
14 app.set_help_all_flag("--help-all", "Expand all help");
15 app.add_flag("--version", "Get version");
16
17 CLI::App *cameraApp = app.add_subcommand("camera", "Configure the app camera");
18 cameraApp->require_subcommand(0, 1); // 0 (default) or 1 camera
19
20 std::string mvcamera_config_file = "mvcamera_config.json";
21 CLI::App *mvcameraApp = cameraApp->add_subcommand("mvcamera", "MatrixVision Camera Configuration");
22 mvcameraApp->add_option("-c,--config", mvcamera_config_file, "Config filename")
23 ->capture_default_str()
24 ->check(CLI::ExistingFile);
25
26 std::string mock_camera_path;
27 CLI::App *mockcameraApp = cameraApp->add_subcommand("mock", "Mock Camera Configuration");
28 mockcameraApp->add_option("-p,--path", mock_camera_path, "Path")->required()->check(CLI::ExistingPath);
29
30 CLI11_PARSE(app, argc, argv);
31}

Callers

nothing calls this directly

Calls 7

set_help_all_flagMethod · 0.80
add_flagMethod · 0.80
require_subcommandMethod · 0.80
add_subcommandMethod · 0.45
checkMethod · 0.45
add_optionMethod · 0.45
requiredMethod · 0.45

Tested by

no test coverage detected