I need to use following syntax for a program:
myprogram config.ini --option1 value --option2 value2
I'm using something like following:
namespace po = boost::program_options;
po::options_description desc("Allowed options");
desc.add_options()
("option1", po::value<std::string>()->required(), "option 1")
("option2", po::value<uint16_t>()->required(), "option 2")
("help", "this message");
po::variables_map opts;
po::store(po::command_line_parser(argc, argv).options(desc).run(), opts);
if (opts.count("help")) {
show_help(desc);
return 0;
}
po::notify(opts);
Can Boost.Program_options be used for catching first parameter (config.ini
)? Or any value without option specifier?