Opened 11 years ago

Last modified 10 years ago

#5656 new Feature Requests

Support options without '='

Reported by: olafvdspek@… Owned by: Vladimir Prus
Milestone: Boost 1.48.0 Component: program_options
Version: Boost 1.46.1 Severity: Problem
Keywords: Cc:

Description

parse_config_file throws invalid_syntax when a line doesn't contain '=' But for bool options, a '=' should not be required.

Change History (4)

comment:1 by Vladimir Prus, 11 years ago

Options without = just look weird.

Also, please don't set milestones when filing issues.

comment:2 by olafvdspek@…, 11 years ago

I'm trying to parse an existing format, so I don't get to decide what's valid and what's not.

comment:3 by uniwangshan@…, 10 years ago

I second this request. I'm trying to replace a 3rd party parsing library using boost::program_options, but the original config has comments starting with ; rather than #.

for example: ; this is a comment

Because program_options hardcoded # as comment and won't allow any line without = except sections, I had to abort this plan.

It would be much better to ignore weird looking lines rather than stop the whole parsing.

comment:4 by rhys.ulerich@…, 10 years ago

I'll third this request. Options created using boost::program_options::bool_value should not require a trailing equals sign when using parse_config_file. If --flagname= is a parse error for such an option according to command_line_parser, then flagname= should not be required by parse_config_file.

Note: See TracTickets for help on using tickets.