You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Achim Felber <af...@austin.rr.com> on 2003/04/06 23:34:46 UTC
Use of GnuParser
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
incorrectly?
Achim
--
Achim Felber
e-mail: afelber@austin.rr.com