Boost logo

Boost :

From: SourceForge.net (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:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1395874&group_id=7586

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[])
{
  try
    {
      bool all, all_chroots, all_sessions;

      opt::options_description chroot("Chroot selection");
      chroot.add_options()
        ("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);
      opt::notify(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 opt.cc -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.

Regards,
Roger

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:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1395874&group_id=7586

-------------------------------------------------------
This SF.net 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!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Boost-bugs mailing list
Boost-bugs_at_[hidden]
https://lists.sourceforge.net/lists/listinfo/boost-bugs


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk