Boost logo

Boost Users :

Subject: Re: [Boost-users] [Program Options] Requiring command-line options
From: Jeremy Abramson (abramson_at_[hidden])
Date: 2010-06-09 19:43:01


Since there isn't any documentation about this, what's the expected
behavior here? Does it require that if you include the argument, you
must include a parameter, or does it mean that you have to require the
argument itself? The latter is the preferred behavior (for me) but from
some brief experimentation, that doesn't seem to be the case. Of
course, I'm not even sure I'm using it correctly, since it's not
documented anywhere.

Any tips?

Thanks!
J.

> Message: 5 Date: Fri, 4 Jun 2010 11:40:00 +0800 From: "Diederick C.
> Niehorster" <dcnieho_at_[hidden]> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [Program Options] Requiring command-line
> options Message-ID:
> <AANLkTilD9kvnz0sU03y5kh5CUwWKNLCXxWid-zwAicot_at_[hidden]>
> Content-Type: text/plain; charset=UTF-8 So this is not in the
> documentation? Could you add a ticket in track to fix the
> documentation? Best, Dee On Thu, Jun 3, 2010 at 9:09 PM, immanuel
> litzroth <ilitzroth_at_[hidden]> wrote:
>> > This seems to work for me:
>> > ?("namespace", po::value<std::string>(&args.name_space)->required(),"namespace
>> > to scrub")
>> > throws an exception when appropriate:
>> > ERROR - main: Caught an exception exiting main: missing required
>> > option namespace
>> > I remember having to hunt for it too.
>> > Greetz,
>> > Immanuel
>> >
>> > On Thu, Jun 3, 2010 at 9:41 AM, Jeremy Abramson <abramson_at_[hidden]> wrote:
>>
>>> >> Heya! ?I just thinking about switching from simpleOpt to BoostPO for command
>>> >> line handling, mainly because of its support of configuration files. ?This
>>> >> may be a stupid question, but I haven't seen anything about making a command
>>> >> line parameter *required*. ?You'd think this is a pretty common thing, but I
>>> >> didn't see any mention of it in the tutorials or anything. ?I guess I could
>>> >> just make certain parameters default -1/NULL or something, and then test at
>>> >> the end if they're still equal to that, but that seems a bit ugly.
>>> >> Is there built in support (a flag in the "add_options" function or
>>> >> something) for making certain parameters required?
>>> >>
>>> >> Thanks a lot!
>>> >>
>>> >> _______________________________________________
>>> >> Boost-users mailing list
>>> >> Boost-users_at_[hidden]
>>> >> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>> >>
>>>
>> > _______________________________________________
>> > Boost-users mailing list
>> > Boost-users_at_[hidden]
>> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
>> >
>>

>
>



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