22int main(
int argc,
char** argv)
24 bpo::variables_map vm;
25 bpo::options_description opt_general(
"Usage:\n" + std::string(argv[0]) +
26 "Convert TOF digits to CRU raw data\n");
27 bpo::options_description opt_hidden(
"");
28 bpo::options_description opt_all;
29 bpo::positional_options_description opt_pos;
32 auto add_option = opt_general.add_options();
33 add_option(
"help,h",
"Print this help message");
34 add_option(
"output-dir,o", bpo::value<std::string>()->default_value(
"./"),
"output directory for raw data");
35 add_option(
"file-for,f", bpo::value<std::string>()->default_value(
"cru"),
"single file per: all,cru,link");
36 add_option(
"configKeyValues", bpo::value<std::string>()->default_value(
""),
"comma-separated configKeyValues");
38 add_option(
"hbfutils-config,u", bpo::value<std::string>()->default_value(
"none"),
"config file for HBFUtils (or none)");
39 opt_all.add(opt_general).add(opt_hidden);
40 bpo::store(bpo::command_line_parser(argc, argv).options(opt_all).positional(opt_pos).run(), vm);
42 if (vm.count(
"help")) {
43 std::cout << opt_general << std::endl;
48 }
catch (bpo::error& e) {
49 std::cerr <<
"ERROR: " << e.what() << std::endl
51 std::cerr << opt_general << std::endl;
53 }
catch (std::exception& e) {
54 std::cerr << e.what() <<
", application will now exit" << std::endl;
59 " --file-for ", vm[
"file-for"].as<std::string>(),
60 " --hbfutils-config ", vm[
"hbfutils-config"].as<std::string>(),
61 R
"( --configKeyValues ")", vm["configKeyValues"].as<std::string>(),
'"');
62 return system(cmd.c_str());