28CommandLineParser::CommandLineParser(
int argc,
char* argv[])
30 char oneConfigFile[] =
"config-file";
31 char manyConfigFiles[] =
"config-files";
32 char helpConfigStr[] =
"help-config";
34 boost::program_options::options_description opt(
"neXtSIM_DG command line options:");
37 "print help associated with one or more modules.\n"
38 "avail list all available module names.\n"
39 "moduleName print the help message associated with the given module.\n"
40 "all print all help messages associated with all available modules.";
42 (
"help,h",
"print help message")
43 (helpConfigStr, boost::program_options::value<std::string>(), helpConfigHelp.c_str())
44 (oneConfigFile, boost::program_options::value<std::string>(),
45 "specify a configuration file")
47 boost::program_options::value<std::vector<std::string>>()->multitoken(),
48 "specify a list of configuration files" )
51 auto parsed = boost::program_options::command_line_parser(argc, argv)
53 .style(boost::program_options::command_line_style::
57 boost::program_options::store(parsed, m_arguments);
60 if (m_arguments.count(
"help") || m_arguments.empty()) {
61 std::cerr << opt << std::endl;
62 std::exit(EXIT_SUCCESS);
68 for (
auto& lionOption : parsed.options) {
69 if (lionOption.string_key == oneConfigFile || lionOption.string_key == manyConfigFiles) {
70 for (
auto& stringValue : lionOption.value) {
71 m_configFilenames.push_back(stringValue);
73 }
else if (lionOption.string_key == helpConfigStr) {
74 m_configHelp = lionOption.value.front();