9 #include <boost/program_options/options_description.hpp> 10 #include <boost/program_options/parsers.hpp> 17 namespace bpo = boost::program_options;
39 if (
nullptr == _options)
40 throw std::runtime_error(
"Internal error: options' container is empty.");
43 bpo::options_description options(
"dds-custom-cmd options");
44 options.add_options()(
"help,h",
"Produce help message");
45 options.add_options()(
"version,v",
"Version information");
46 options.add_options()(
47 "condition,t", bpo::value<std::string>(&_options->
m_sCondition),
"Condition to be applied to a task.");
48 options.add_options()(
"cmd,c", bpo::value<std::string>(&_options->
m_sCmd),
"Command to be sent to task.");
51 bpo::variables_map vm;
52 bpo::store(bpo::command_line_parser(_argc, _argv).options(options).run(), vm);
55 if (vm.count(
"help") || vm.empty())
60 if (vm.count(
"version"))
std::string m_sCmd
Definition: dds-custom-cmd/src/Options.h:32
dds-commander's container of options
Definition: dds-custom-cmd/src/Options.h:24
SOptions()
Definition: dds-custom-cmd/src/Options.h:26
#define LOG(severity)
Definition: Logger.h:34
Miscellaneous functions and helpers are located here.
Definition: AgentConnectionManager.h:13
bool ParseCmdLine(int _argc, char *_argv[], SOptions *_options)
Definition: dds-custom-cmd/src/Options.h:37
struct dds::custom_cmd::SOptions SOptions_t
dds-commander's container of options
std::string m_sCondition
Definition: dds-custom-cmd/src/Options.h:33