Boost logo

Boost Users :

Subject: Re: [Boost-users] [Program Options] terminate parsing after first positional argument
From: Evan Driscoll (driscoll_at_[hidden])
Date: 2012-08-03 12:14:02


[I was away for a couple weeks shortly after sending the message below
so I didn't push very hard at the time, but now that I'm back I figured
I'd try to revive this discussion.]

To try to reset the context, I and others want the ability to stop
argument parsing at the first positional argument, so that it's possible
to write a program with a syntax like xargs/valgrind/many other tools.

The ideal would be to have an 'allow_interspersed' style option which
would be set by default (to give the now-usual behavior of "cmd arg
--opt" being the same as "cmd --opt arg") but which a client program
could unset if they wanted the xargs-like behavior.

However, I don't see how to do this, because
> If someone says
> style_t style = allow_short | allow_slash_for_short
> I can't automatically go and set allow_interspersed for them as well.

And so without some ugly and not-worth-it coding tricks (changing
style_t to a class), unless I'm missing something you can't pick this
ideal without breaking backwards compatibility.

So I instead suggested a new 'disallow_interspersed' style option, which
would be off by default (keeping backwards compatibility) but you could
set it to get xargs-like behavior, but this is inconsistent with all the
other style flags which are allow_xxx.

So what do you want to do regarding this issue?

References:
   Trac issue: https://svn.boost.org/trac/boost/ticket/6991
      (includes a patch for both of those options)

   The previous messages in this discussion:
      http://lists.boost.org/boost-users/2012/07/75100.php

Evan


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