Opened 9 years ago

Last modified 7 years ago

#8588 new Bugs

program_options eats parameter instead of reporting previous one missing an argument

Reported by: Adam Nielsen <a.nielsen@…> Owned by: Vladimir Prus
Milestone: To Be Determined Component: program_options
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

If a parameter is specified with a mandatory argument, but the argument is omitted, the following parameter is used as the argument instead. For example:

  ./test --dump-firmware
  Invalid command line syntax: the required argument for option '--firmware' is missing.  Use --help for help.
  ./test --dump-firmware --help
  dumping firmware to file: --help

Here, --dump-firmware requires an argument, and "--help" is passed in as the argument. Instead, "--help" should be treated as a parameter (either valid or not) and --dump-firmware should report a missing parameter instead.

Attachments (1)

program_options_eat_param.cpp (1.2 KB ) - added by Adam Nielsen <a.nielsen@…> 9 years ago.
Example to demonstrate the issue

Download all attachments as: .zip

Change History (2)

by Adam Nielsen <a.nielsen@…>, 9 years ago

Example to demonstrate the issue

comment:1 by anonymous, 7 years ago

Can this bug be fixed? It is rather annoying.

Note: See TracTickets for help on using tickets.