commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Keyes <j...@mac.com>
Subject [CLI] Configurable Parsers
Date Sat, 15 Jun 2002 15:21:03 GMT
I have a prototype of the configurable parser stuff
that I wanted implemented.  The Options constructor
checks to see if the org.apache.commons.cli.parser
system property is set.  If the property is set try to
create an instance of that class (the class implements
the CommandLineParser interface), if the class cannot
be created warn the user and create an instance of the
default parser (the current impl).  If the property is
not set, create a version of the default parser also.
Any comments on this approach?

I have created a parser (it is currently called the
GnuParser, but this may need to change as it may not
be completely accurate) that will provide the functionality
that tools like ant need i.e. '-buildfile' can be used
as an atomic option.  The only way to create an option
like this, currently is to add more constructors to
Option that do not have 'char' as the first param.  This
sucks coz then equivalent addOption methods will have to
be added to Options.  I propose a small API change to
resolves this.  If the char parameter is replaced with
a String parameter then both types of Option can be
created.  From a users perspective this would involve
changing the creation of the Options instance e.g.

Options = new Options().addOption( 'f', false, "filename" );

would have to change to:

Options = new Options().addOption( "f", false, "filename" );

What do people think of this idea?

Cheers,
-John K


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message