
On 04.07.2012 20:37, Evan Driscoll wrote:
On 01/-10/-28163 01:59 PM, Stuart Pook wrote:
Hello,
How can I tell Boost Program Options to stop parsing the arguments as soon as it finds a positional argument?
I asked this question a few weeks ago and filed a feature request: https://svn.boost.org/trac/boost/ticket/6991
There is a patch attached to the bug report which seems to work for me, however, you of course will have to use a modified version of Boost. (And it's a compiled library so more than just header changes as well.)
I don't know the best way to get that option from the client code down to where it's needed, so right now choosing that behavior or the default one is done by changing the Boost code and recompiling. :-)
(Incidentally, from my biased perspective I'd say that the fact that there were two independent requests for this feature inside a month, not to mention the old one linked in the quoted post which sites another a couple weeks prior to *that*, speaks to the importance of this feature. I'd like to reiterate my offer to help with any of documentation, tests (if someone can sketch out how to add one), and implementation (if someone sketches out a high-level implementation).)
Evan, that patch of yours looks perfectly reasonable to me. It would seem that a style option, e.g. 'allow_intermixed' can be used to control this behaviour (with the current behaviour as default). As for testing, you can add a new function to tests/positional_options_test.cpp, and call it from main. The structure of existing tests should be straightfoward. For avoidance of doubt, if you come up with a patch along these lines, I'll be happy to commit it. Thanks, Volodya