Boost logo

Boost :

From: Roger Leigh (rleigh_at_[hidden])
Date: 2006-01-02 18:51:51


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 abigous for
GNU getopt or GLib GOption, so this is IMHO a bug.

Regards,
Roger

Versions of packages libboost-program-options-dev depends on:
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++

- --
Roger Leigh
                Printing on GNU/Linux? http://gimp-print.sourceforge.net/
                Debian GNU/Linux http://www.debian.org/
                GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>

iD8DBQFDubyOVcFcaSW/uEgRAv/1AJ0bMx0Me4owHITYjdQqjJz+N+yNOACggbU7
rTykg0EABvU1XIiX+LZ5KjY=
=QqE/
-----END PGP SIGNATURE-----


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