|
Boost : |
From: Thomas Dilling (Thomas.Dilling_at_[hidden])
Date: 2005-04-29 02:54:02
Am Fri, 29 Apr 2005 09:55:56 +0400 schrieb Vladimir Prus:
>> Hi Volodya,
>> is it possible to get a list of unrecognized options.
>> I have to forward this options to another library.
>
> I'm still waiting for Doug to comment on my committing this feature. What I
> plan is that the 'option' class will get two additional members. First is
> 'bool unknown'. So, you'll be able to walk the vector of option and pick
> option that have this member set to 'true'.
>
> The other new member will be 'vector<string> original_tokens;'. The standard
> parser will set it to the command line tokens parsed to form the option. It
> can be used to reconstruct back the unrecognized elements of command line.
>
> So, if you pass
>
> --foo 10 --bar=12
>
> and no options is registered, you'll get vector of three options.
>
> 1. "foo", with no value, and "original_tokens" set to "--foo"
> 2. 10, which will be marked as positional
> 3. "bar" with value "12", and "original_tokens" set to "--bar=12"
>
> All of them will be 'unknown' flag set. So, you can both pass the
> unrecognized options to another library, or reconstruct the command line
> for unrecognized options.
>
> Will that be OK for you?
Hi Volodya,
sounds great.
Better than my idea, which i had last night:
optionally passing a std::vector<std::string> in allow_unregistered, in
that all unknown options are collected.
But doing it this way, options become "neighbors" that were not in the
original options list.
Regards,
Thomas
PS: great library, thank you
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk