Bogus assumption on where non-control arguments appear
Brought to you by:
dsosnoski
Line 164 in ArgumentProcessor.java can end it all before a
single argument has been processed, even if there are
arguments coming down the pipe:
You get to that line if
m_currentArg.hasNext()
is false, and
m_remainingArgs.hasNext()
is true, and
next.length() > 0 && next.charAt(0) == "-"
is false.
More succinctly, "next.length() > 0" could evaluate to
true,
but if that first argument is not a control flag,
nothing is
processed. Is the assumption simply that non-control
arguments must come last? That seems moderately bogus
to me in an argument-processing library where it's
difficult
to make assumptions about the command line interface.
Logged In: YES
user_id=1103654
It appears that the problem is an implicit assumption in
StringTracker that once you call next(), the current
argument is consumed. If StringTracker explicitly handled
consumption, and simply avoids consuming arguments that it
can't parse, this problem would be alleviated (it would also
make other things I'm trying to do easier).
I'll have a patch here soon as I can.