3

Using boost::program_options, I'd like to allow only --option=arg style for arguments and forbid the space separated --option arg which is sometimes ambiguous when arguments are optional.

Looks kind of possible. Having a look at cmdline.hpp source (found no documentation), I tried to use a restricted option style including only allow_long and long_allow_adjacent, and 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);

Unfortunately --option arg are still accepted by this parser...

Bug maybe? (libboost_program_options-1_46.so.1.46.1)

  • I've just started to use boost::program_options few days ago, and there are plenty of bugs there. You can even find some bug reports, which are essential and relatively easy to solve, but has been opened for 19 months (https://svn.boost.org/trac/boost/ticket/3813). Shame as it provides very convenient way of parsing program options. – tomasz Jul 22 '11 at 11:00

0 Answers0