I am using boost::program_options like this:
namespace po = boost::program_options;
po::options_description desc("Options");
desc.add_options()
("help,?", "Show Options")
("capture-file,I", po::value<string>(), "Capture File")
("capture-format,F", po::value<string>()->default_value("pcap"), "Capture File Format")
("output-file,O", po::value<string>()->default_value("CONOUT$"), "Output File");
po::variables_map vm;
po::store(po::command_line_parser(ac, av).options(desc)./*positional(pd).*/run(), vm);
If I pass the command line parameter -I hithere
it works, but it I pass /I hithere
boost throws a boost::bad_any_cast
with a what()
of " failed conversion using boost::any_cast".
Is it possible to use program_options to parse either /
-delimitted or -
-delimitted options? Bonus question, can it be configured so that /
and -
set the same option, but are binary opposites of each other? For example, /verbose
might mean verbose logging while -verbose
might mean less verbose logging.