commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Achim Felber <>
Subject Use of GnuParser
Date Sun, 06 Apr 2003 21:34:46 GMT
Hi folks,

when I recently had the need for a command line parser I discovered the
CLI library. For my application the GnuParser seemed to provide the best
match. I ran into a small problem, though. Among other things, my application 
needs to support two options; -T and -O, both requiring an argument:
  sampleAppl -T <arg1> -O <arg2>

Unfortunately, "O" is also a valid value for arg1:
  sampleAppl -T O 

GnuParser interpreted in this commandline the "O" as option "-O" not as
value for "-T". This caused a MissingArgumentException to be thrown.

I decided to derive my own parser class from GnuParser and to overwrite
the processArgs() method.

Was this the right approach or did I use the existing classes


Achim Felber

View raw message