Subject: [Boost-bugs] [Boost C++ Libraries] #2577: ambigous program options
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-12-08 19:16:02
#2577: ambigous program options
----------------------------------------------------------------+-----------
Reporter: Georg Sauthoff <gsauthof_at_[hidden]> | Owner: vladimir_prus
Type: Bugs | Status: new
Milestone: To Be Determined | Component: program_options
Version: Boost 1.34.1 | Severity: Regression
Keywords: |
----------------------------------------------------------------+-----------
Basically a variation of this regression:
http://lists.boost.org/Archives/boost/2006/01/98811.php
To trigger it again you have to slightly modify the test case:
{{{
# include <iostream>
# include <boost/program_options.hpp>
int main(int argc, char * argv[])
try {
using namespace boost::program_options;
options_description desc("Options");
desc.add_options()
("foo", "foo")
("foobar", "foobar")
("foo-bar", "foo-bar")
("barbar", "barbar")
("bar-bar", "bar-bar")
("bar", "bar")
;
parsed_options parsed = parse_command_line(argc, argv, desc);
variables_map vm;
store(parsed, vm);
notify(vm);
std::cerr << vm.count("foo") << std::endl;
std::cerr << vm.count("foobar") << std::endl;
std::cerr << vm.count("foo-bar") << std::endl;
std::cerr << vm.count("bar") << std::endl;
std::cerr << vm.count("barbar") << std::endl;
std::cerr << vm.count("bar-bar") << std::endl;
} catch (std::exception & ex) {
std::cerr << argv[0] << ": " << ex.what() << std::endl;
return EXIT_FAILURE;
}
}}}
{{{
$ ./a.out --foo
1
0
0
0
0
0
}}}
{{{
$ ./a.out --bar
./a.out: ambiguous option bar
}}}
Btw, wouldn't it make more sense, if boost program_options would do its
ambiguity checking as part of add_options()? I mean before the actual
parsing step ...
PS: Take a look at: https://svn.boost.org/trac/boost/ticket/545
I get there:
{{{
Oopsâ¦
Trac detected an internal error:
TypeError: a float is required
}}}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2577> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC