使用 boost::program_options,我想只允许--option=arg
参数的样式并禁止空格分隔--option arg
,这在参数是可选的时有时会模棱两可。
看起来有点可能。查看cmdline.hpp源代码(未找到文档),我尝试使用受限选项样式,仅包括allow_long
andlong_allow_adjacent
和 without long_allow_next
:
int optStyle =
po::command_line_style::allow_long |
po::command_line_style::long_allow_adjacent;
po::command_line_parser parser(argc, argv);
parser.style(optStyle);
不幸--option arg
的是仍然被这个解析器接受......
可能是虫子?(libboost_program_options-1_46.so.1.46.1)