6

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

MQ Gu
  • 643
  • 2
  • 9
  • 19

1 Answers1

5

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);
Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • 3
    This would not handle ':' as option/value separator though. For that, one would need a custom parser, which is the first item in the "Howto" section of the documentation. – Vladimir Prus Aug 02 '11 at 06:58