Boost logo

Boost Users :

From: Vsevolod Vlaskin (vlaskine_at_[hidden])
Date: 2006-01-05 00:24:19


Hi,

I am trying to allow unknown options in the command
line of my application (as described in "Allowing
Unknown Options" section of program_options docs).

Here is the code snippet:

//-----------------------------------------------------
boost::program_options::options_description
my_options("Options");
my_options.add_options()
    /* adding some allowed options */
;
        
boost::program_options::variables_map vm;

boost::program_options::store(
boost::program_options::command_line_parser( ac, av
).options( my_options ).allow_unregistered().run(), vm
);

boost::program_options::notify( vm );
//-----------------------------------------------------

If an option is not specified in my_options, the call
boost::program_options::store() above throws exception
"unknown option". (I checked that it is store() that
throws.)

Does anyone have any suggestions how I could store and
access the option values in this case? Of course, I
can use basic_parsed_options returned by run(), but it
seems to defeat the convenience of the library. Is
there any way to use store() and variables_map in this
case?

Thank you for help.

Best regards,

Vsevolod Vlaskine

                
__________________________________________
Yahoo! DSL – Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net