12 #include <boost/program_options/options_description.hpp> 13 #include <boost/program_options/parsers.hpp> 18 namespace bpo = boost::program_options;
41 else if (
"clean" == _name)
54 if (
nullptr == _options)
55 throw std::runtime_error(
"Internal error: options' container is empty.");
58 bpo::options_description options(
"dds-agent options");
59 options.add_options()(
"help,h",
"Produce help message");
60 options.add_options()(
"version,v",
"Version information");
61 options.add_options()(
"command",
62 bpo::value<std::string>(),
63 "The command is a name of dds-agent command." 64 " Can be one of the following: start, clean.\n" 65 "For user's convenience it is allowed to call dds-agent without \"--command\" option" 66 " by just specifying the command name directly, like:\ndds-agent start.\n\n" 68 " start: \tStart dds-agent\n" 69 " clean: \tCleaning");
70 options.add_options()(
71 "slots,s", bpo::value<size_t>(&_options->
m_slots),
"Defines a number of task slots per agent.");
74 bpo::positional_options_description pd;
78 bpo::variables_map vm;
79 bpo::store(bpo::command_line_parser(_argc, _argv).options(options).positional(pd).run(), vm);
82 if (vm.count(
"help") || vm.empty())
87 if (vm.count(
"version"))
94 if (vm.count(
"command"))
99 <<
"DDS error: unknown command: " << vm[
"command"].as<std::string>() <<
"\n\n"
SOptions()
Definition: dds-agent/src/Options.h:33
#define LOG(severity)
Definition: Logger.h:34
struct dds::agent_cmd::SOptions SOptions_t
dds-commander's container of options
Miscellaneous functions and helpers are located here.
Definition: AgentConnectionManager.h:13
dds-commander's container of options
Definition: dds-agent/src/Options.h:25
bool ParseCmdLine(int _argc, char *_argv[], SOptions *_options)
Definition: dds-agent/src/Options.h:52
Definition: dds-agent/src/Options.h:29
static ECommands getCommandByName(const std::string &_name)
Definition: dds-agent/src/Options.h:37
Definition: dds-agent/src/Options.h:31
size_t m_slots
Definition: dds-agent/src/Options.h:48
ECommands m_Command
Definition: dds-agent/src/Options.h:47
Definition: dds-agent/src/Options.h:30
ECommands
Definition: dds-agent/src/Options.h:27