Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 809
MQ Gu Avatar asked Aug 02 '11 03:08

MQ Gu


1 Answers

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);
like image 159
Nicol Bolas Avatar answered Nov 09 '22 11:11

Nicol Bolas