[Boost-bugs] [Boost C++ Libraries] #11392: boost::program_options accepting switch-options that match the beginning of defined option, but is not full option typed out.

Subject: [Boost-bugs] [Boost C++ Libraries] #11392: boost::program_options accepting switch-options that match the beginning of defined option, but is not full option typed out.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-06-11 08:48:02


#11392: boost::program_options accepting switch-options that match the beginning of
defined option, but is not full option typed out.
---------------------+------------------------------
 Reporter: eg@… | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.57.0
 Severity: Problem | Keywords:
---------------------+------------------------------
 With:

     namespace po = boost::program_options;
     po::options_description desc ("options");
     desc.add_options ()
       ( "help,h", "print this help message")
       ( "config,c", po::value<ustring>(), "config file, default:
 $XDG_CONFIG_HOME/astroid/config")
       ( "new-config,n", "make new default config, then exit")
       ( "mailto,m", po::value<ustring>(), "compose mail with mailto url or
 address")
       ( "no-auto-poll", "do not poll automatically");

     po::variables_map vm;

     bool show_help = false;

     try {
       po::store ( po::parse_command_line (argc, argv, desc), vm );
     } catch (po::unknown_option &ex) {
       cout << "unknown option" << endl;
       cout << ex.what() << endl;
       show_help = true;

     }

 running:

 ./program --asdf

 fails, but running:

 ./program --hel

 is parsed as --help.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11392>
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:50:18 UTC