9 #include <boost/program_options/options_description.hpp> 10 #include <boost/program_options/parsers.hpp> 11 #include <boost/property_tree/ptree.hpp> 14 #if BOOST_VERSION < 105900 15 #pragma clang diagnostic push 16 #pragma clang diagnostic ignored "-Wunused-local-typedef" 18 #include <boost/property_tree/ini_parser.hpp> 19 #if BOOST_VERSION < 105900 20 #pragma clang diagnostic pop 23 #include <boost/filesystem/operations.hpp> 24 #include <boost/filesystem/path.hpp> 34 namespace bpo = boost::program_options;
61 return _stream <<
"\nRMS: " << val.
m_sRMS <<
"\nPlug-in's configuration file: " << val.
m_sCfgFile;
67 <<
"DDS configuration" 68 <<
" v" << USER_DEFAULTS_CFG_VERSION <<
"\n" 75 if (
nullptr == _options)
76 throw std::runtime_error(
"Internal error: options' container is empty.");
79 bpo::options_description options(
"dds-submit options");
80 options.add_options()(
"help,h",
"Produce help message");
81 options.add_options()(
"version,v",
"Version information");
82 options.add_options()(
83 "list,l", bpo::bool_switch(&_options->m_bListPlugins),
"List all available RMS plug-ins");
84 options.add_options()(
"rms,r",
85 bpo::value<std::string>(&_options->m_sRMS),
86 "Defines a destination resource " 87 "management system plug-in. Use " 88 "\"--list\" to find out names " 89 "of available RMS plug-ins.");
90 options.add_options()(
"config,c",
91 bpo::value<std::string>(&_options->m_sCfgFile),
92 "A plug-in's configuration file. It can be used to provide additional RMS options");
93 options.add_options()(
"path",
94 bpo::value<std::string>(&_options->m_sPath),
95 "A plug-in's directory search path. It can be used for external RMS plug-ins.");
96 options.add_options()(
"number,n",
97 bpo::value<size_t>(&_options->m_number),
98 "Defines a number of agents to spawn." 99 "If 0 is provided as an argument, then a number of available logical cores will be " 100 "used.\nThis option can not be mixed with \"--config\"");
103 bpo::variables_map vm;
104 bpo::store(bpo::command_line_parser(_argc, _argv).options(options).run(), vm);
112 bpo::variables_map::const_iterator found =
113 find_if(vm.begin(), vm.end(), [](
const bpo::variables_map::value_type& _v) {
114 return (!_v.second.defaulted());
117 if (vm.count(
"help") || vm.end() == found)
123 if (vm.count(
"rms") && !vm.count(
"config") && !vm.count(
"number"))
128 if (vm.count(
"version"))
138 if (!_options->m_sCfgFile.empty())
140 boost::filesystem::path pathCfgFile(_options->m_sCfgFile);
141 _options->m_sCfgFile = boost::filesystem::absolute(pathCfgFile).string();
SOptions()
Definition: dds-submit/src/Options.h:43
size_t m_number
Definition: dds-submit/src/Options.h:55
_T & to_lower(_T &_str)
convert string to lower case.
Definition: MiscUtils.h:245
dds-commander's container of options
Definition: dds-submit/src/Options.h:41
#define LOG(severity)
Definition: Logger.h:54
std::string m_sRMS
Definition: dds-submit/src/Options.h:52
void PrintVersion()
Definition: dds-submit/src/Options.h:64
const LPCSTR g_cszReportBugsAddr("Report bugs/comments to fairroot@gsi.de")
Definition: dds-agent/src/AgentConnectionManager.h:16
struct dds::submit_cmd::SOptions SOptions_t
dds-commander's container of options
std::string m_sPath
Definition: dds-submit/src/Options.h:54
void conflicting_options(const boost::program_options::variables_map &_vm, const char *_opt1, const char *_opt2)
The conflicting_options function used to check that 'opt1' and 'opt2' are not specified at the same t...
Definition: BOOSTHelper.h:62
std::string m_sCfgFile
Definition: dds-submit/src/Options.h:53
std::ostream & operator<<(std::ostream &_stream, const SOptions &val)
Definition: dds-submit/src/Options.h:59
bool m_bListPlugins
Definition: dds-submit/src/Options.h:56
bool ParseCmdLine(int _argc, char *_argv[], SOptions *_options)
Definition: dds-submit/src/Options.h:73