Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost program options] missing value validation
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-01-23 04:25:04


Andy F wrote:

> Vladimir Prus <vladimir <at> codesourcery.com> writes:
>
>
>> Seems like some part is left out of our question "if the user does not provide
> a value",
>> then what?
>>
>> > do I need to basically handle that in the catch block of the exception
>> > handling, or is there some other way of doing it upfront?
>>
>> - Volodya
>>
>
> Sorry, I seem to be asleep at the wheel today. What I am saying is if the user
> does not provide a value for the option, and the value is required, is my only
> option to handle this in the catch block or is there a way to do this some other
> way?
>
> E.g. I define an option --env which much have a value. If the user just runs
> a.out --env, and not a.out --env=PROD, then it seems that the exception is
> thrown. Is there some way of checking it without doing the exception handling?

No, I don't think it's possible.

- Volodya


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