How to support commandline syntax “-DEVICE:iphone” in Boost::Program_Options?

人走茶凉 提交于 2019-12-10 14:09:23

问题


The default syntax for Boost::Program_Options is "--DEVICE iphone". How can I support syntax "-DEVICE:iphone" or "-DEVICE=iphone"?


回答1:


Boost.Program_Options has a pretty large number of option styles. The particular combination you seem to be going for would be:

command_line_style::long_allow_adjacent |
command_line_style::short_allow_adjacent |
command_line_style::allow_long_disguise

These options should be given to the style function of your command line parser:

    po::store(po::command_line_parser(argc, argv).style(<your styles here>).run(), vm);


来源:https://stackoverflow.com/questions/6906991/how-to-support-commandline-syntax-deviceiphone-in-boostprogram-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!