|
Boost Users : |
Subject: Re: [Boost-users] program_options hierarchical options
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-11-09 05:34:22
Yang Zhang wrote:
> On Mon, Nov 9, 2009 at 12:00 AM, Vladimir Prus
> <vladimir_at_[hidden]> wrote:
>> Yang Zhang wrote:
>>
>>> Is there an example of using program_options to build a hierarchical
>>> options parser (a la svn, apt-get, git, etc.), in which earlier
>>> options select parsers for later options?
>>
>> SVN option parsing do not, in fact, select parsers for later options.
>> There's a single global set of options, it's just the first positional
>> token that is taken to mean 'command', and for each command, and additional
>> check is performed that only options that are relevant for that command
>> are specified. Such check has to be done manually with the current
>> version of program_options -- but does not seem a hard thing to do.
>
> Then forget svn and consider git.
<rant>
I am afraid I dislike git enough to be unable to see any sense it its
interface -- even if some is there.
</rant>
> I was just pulling an arbitrary
> example; the particular example wasn't the focus. The question
> remains.
The answer is that while you can create multiple option_descriptions objects,
look at the first token on the command line, and then pick an suitable
object from that, it must be done by hand.
- 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