[Jargp-general] bug with initial non-control flags?
Brought to you by:
dsosnoski
|
From: Matthew W. <un...@id...> - 2004-09-14 05:58:01
|
Howdy. I started taking a look at JArgP today, and in the short term it
does everything I need. But I thought I'd take a look inside anyway...
I *think* I've found a bug. I'm tired, and I haven't done Java
programming in forever, but it sure looks like a bug.
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.
I came across this as I delved into the code trying to add long arguments in
the GNU style ('--foo' and/or '--foo bar' and/or '--foo=bar'). I think I'll
also look into being able to specify a control flag more than once (like
'-m onefile -m anotherfile -m thirdfile') and have it load values into an
array, but I figured this would be the easier first step.
--
Matthew Weigel
hacker
un...@id...
|