Boost logo

Boost Users :

Subject: Re: [Boost-users] [Program Options] terminate parsing after first positional argument
From: Olaf Meeuwissen (olaf.meeuwissen_at_[hidden])
Date: 2012-07-08 19:42:59


driscoll_at_[hidden] writes:

> Olaf Meeuwissen writes:
>> Interspersed options/arguments are unregistered, aren't they?
>
> No, not necessarily. Consider
> foo --help
> foo target_program --help
> or (going full inception)
> foo foo --any-flag
>
> which is why
>
>> When the parser sees the first unregistered option it can
>> just stop parsing.
>
> isn't a good solution (though much better than the current state): parsing
> really needs to stop at the first *positional* argument, not at the first
> unrecognized option.

Point taken, but I think there may be a need for *both* behaviours. My
use case would definitely become easier to implement if the command line
parser could be instructed to stop at the first occurence of either a
positional argument or an unrecognized option. So far I've been getting
by with not registering the positional argument and reverting state for
all arguments recognized after the first one that was not recognized.

Hope this helps,

-- 
Olaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962               Help support software freedom
                 http://www.fsf.org/jf?referrer=1962

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