29std::optional<EInfo> Application::ParseOptions(
int argc,
char* argv[])
34 po::options_description opts(
" Options");
35 auto optsAdd = opts.add_options();
37 optsAdd(
"help,h",
"display this help and exit");
40 optsAdd(
"r,run", po::value<uint32_t>(&fRunId)->required(),
"standard CBM run identifier (required)");
43 optsAdd(
"g,geotag", po::bool_switch(&vbSelected[EInfo::GeoTag])->default_value(
false),
"prints the geometry tag");
44 optsAdd(
"p,print", po::bool_switch(&vbSelected[EInfo::Print])->default_value(
false),
45 "prints available information on the run ID");
47 po::variables_map vars;
48 po::store(po::parse_command_line(argc, argv, opts), vars);
51 if (vars.count(
"help")) {
52 std::cout << opts << std::endl;
56 int nSelectedInfos{0};
57 EInfo selectedInfo{EInfo::Print};
58 for (
size_t iInfo = 0; iInfo < vbSelected.size(); ++iInfo) {
59 if (vbSelected[iInfo]) {
60 selectedInfo =
static_cast<EInfo>(iInfo);
64 if (nSelectedInfos > 1) {
65 throw std::logic_error(
"More then one information items were requested");
68 return std::make_optional(selectedInfo);