Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-03-01 07:58:26


The Grumpiest Man You Know wrote:

>> Can you provide a real example of the syntax you want to support? Why do
>> you want "-F" to mean different things depending on the position on the
>> command line?
>
> Sorry for the slow response, rl sucks. :)
>
> Well it's because there are two separate lists of options. One to the
> program that I'm parsing for and one for code that we just perform a
> pass through to. I have no control over the options recognized by the
> other guy I just want to stop parsing when I get to them. My solution
> was to create a class that defined operator() and use it as the
> additional parser. Then once I spot the change from "my" to "his"
> part. I stick all the words n a dummy option.

The standard approach is the "--" token. Say:

  prog --option1 --option2 -- options_for_the_other_program

When program_options sees '--' it stops looking for the regular options and
everything after is considered 'positional options'.

If you tell me the logic you use to detect the change from "your" to "his"
option, I might suggest another approach.

- 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