16{
17 std::string oksfn;
18
19 bop::options_description options_description("Allowed options", 128);
20
21 options_description.add_options()("help,h", "Provide help message")(
22 "file,f", bop::value<std::string>(&oksfn)->default_value(oksfn), "OKS schema file name");
23
24 bop::variables_map options_map;
25
26 try {
27 bop::parsed_options parsed =
28 bop::command_line_parser(argc, argv).options(options_description).allow_unregistered().run();
29
30
31 const auto& unknown = bop::collect_unrecognized(parsed.options, bop::include_positional);
32 if (unknown.size() != 0) {
33 std::cerr << "Incorrect command line argument, unrecognized options: ";
34 for (const auto& o : unknown) {
35 std::cerr << o << " ";
36 }
37 std::cerr << std::endl;
38
39 return EXIT_FAILURE;
40 }
41
42 bop::store(parsed, options_map);
43 bop::notify(options_map);
44
45 auto display_help_message = [&options_description]() {
46 std::cout << "TDAQ online database schema editor" << std::endl
47 << std::endl
48 << "Usage: schemaeditor [options]" << std::endl
49 << std::endl
50 << options_description << std::endl;
51 };
52
53 if (options_map.count("help")) {
54 display_help_message();
55 return EXIT_SUCCESS;
56 }
57 } catch (std::exception const& e) {
58 std::cerr << "Incorrect command line argument: " << e.what() << std::endl;
59 return EXIT_FAILURE;
60 }
61
62 QApplication a(argc, argv);
63
65
66 w.show();
67
68 return a.exec();
69}