Program Options: Omit positional arguments from help
Hello, I have this piece of code: void getOptions(int argc, char *argv[]) { namespace po = boost::program_options; po::options_description desc("Artificial testing tool."); desc.add_options() ("help", "produce help") ("participant", po::valuestd::string(), "Participant Name"); po::positional_options_description pd; pd.add("participant", 1); po::variables_map vm; //po::store(po::parse_command_line(argc, argv, desc), vm); po::store(po::command_line_parser(argc, argv).options(desc).positional(pd).run(), vm); po::notify(vm); if (vm.count("help")) { std::cout << desc << std::endl; return; } } First question: Is the usage of po::store correct that way? I've found it somehwere on the internet but the documentation mentions no alternative parser call when using positional arguments. Main question: When using help it still displays --participant, albeit it's only a placeholder for the positional argument. Is there a way to hide a options or what is the correct way? Thanks, Florian
participants (1)
-
Florian Lindner