Boost logo

Boost :

From: (noreply_at_[hidden])
Date: 2006-01-03 04:56:57

Bugs item #1395874, was opened at 2006-01-03 09:56
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Roger Leigh (rleigh)
Assigned to: Nobody/Anonymous (nobody)
Summary: Proogram_options: Fails to parse options with a common root

Initial Comment:
Given the following testcase:

#include <iostream>
#include <boost/program_options.hpp>
namespace opt = boost::program_options;

int main(int argc,
         char *argv[])
      bool all, all_chroots, all_sessions;

      opt::options_description chroot("Chroot selection");
        ("all,a", "Select all chroots and active sessions")
        ("all-chroots", "Select all chroots")
        ("all-sessions", "Select all active sessions");

      opt::variables_map vm;
      opt::store(opt::parse_command_line(argc, argv,
chroot), vm);

      if (vm.count("all"))
        all = true;
      if (vm.count("all-chroots"))
        all_chroots = true;
      if (vm.count("all-sessions"))
        all_sessions = true;

      return 0;
  catch (std::exception const& e)
      std::cerr << e.what() << std::endl;
      return 1;

$ g++ -o opt -lboost_program_options
$ ./opt --help
unknown option help
$ ./opt --all-chroots
$ ./opt --all-sessions
$ ./opt --all
ambiguous option all

--all is not abiguous, since it's an exact match. It's
not ambigous for GNU getopt or GLib GOption, so this is
IMHO a bug.


ii libboost-dev 1.33.0-6 Boost C++
Libraries development fi
ii libboost-program-options1.33. 1.33.0-6 program
options library for C++


You can respond by visiting:

This email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
Boost-bugs mailing list

Boost list run by bdawes at, gregod at, cpdaniel at, john at