|
Boost Users : |
Subject: Re: [Boost-users] [Program Options] notifiers for options with no value
From: Dmitriy Matison (matison.d_at_[hidden])
Date: 2011-09-01 18:21:37
I've found an answer for my question,
When defining an option with no value via value-permitted interface,
one must pass not boost::program_options::typed_value() as semantics,
but bool_switch(). This means that no value can be explicitly taken
for this option from the command line.
One can see this question at stackoverflow:
http://stackoverflow.com/questions/7174781/boost-program-options-notifier-for-options-with-no-value
Regards,
Dmitriy.
On 29 August 2011 15:16, Dmitriy Matison <matison.d_at_[hidden]> wrote:
>
> Hello,
>
> I'm wondering if there is a possibility to make program_options library to notify me automatically when option with no value is passed?
> As far as I understand this feature exists only for options with defined value_semantic. But this means I must permit passing a value for such options. Say, I make an option with zero_tokens() semantics so it can be passed without value and throw an error if some value was provided.
> Unfortunately, this doesn't solve the problem if you have positional options. In that case a positional option following a no-value option will be parsed as this option's value.
> I can't set notifier for options with no value? This is something not understandable. I even think of some patch to be added to the lib.
>
> Regards,
> Dmitriy.
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