axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <>
Subject proposed: CLI Args improvement
Date Mon, 10 Sep 2001 16:06:37 GMT
Would it be possible to extend the CLI package in excalibur to
have a CLI Strategy?  Basically, there are two common strategies
in CLI parsing:

GNU style (which we support)
Java/CVS style (as-much-as-needed-to-be-unique).

Basically the approach would go like this:

CLOptionDescriptor optionDescriptors = new CLOptionDescriptor[] {
    new CLOptionDescriptor("version", 'v', VERSION, "Get the Version and quit"),
    new CLOptionDescriptor("valid", 'V', VALID, "Tests to see if the configuration is Valid
and quit")
parser = new CLArgsParser( args, optionDescriptors, control, CLArgsParser.JAVA_STRATEGY );
         // note: for backwards compatibility, the default would be CLArgsParser.AVALON_STRATEGY

This would allow us to parse args in the following manner:

$myapp -ve[rsion]

MyApp Version 1.0


$myapp -va[lid]

MyApp Version 1.0
Error in configuration: line 20

By simply switching the strategy to AVALON_STRATEGY (above), we can perform the
following calls:

$myapp (-v | --version)

MyApp Version 1.0


$myapp (-V | --valid)

MyApp Version 1.0
Error in configuration: line 20

That way, everyone can be made happy--AND as new strategies for CLI parsing are
uncovered, we can support them easily.  This also allows for backwards compatibility.

>From Tom Jordahl in XML-Axis dev:
I looked at this code (because I was writing the command line stuff in
wsdl2java) and it is very GNU-like in its option syntax:
instead of what we currently have:

I am not really in favor of this "two-dash" approach to options, I prefer
(obviously) an "as-much-as needed-to-be-unique" style.  If there is strong
sentiment from the group that we want "two-dash" style options, I would be
-1 on it but would still do the work. :-)

I am adding a -package switch today, which is an option that takes an
argument so I maybe I will convince myself I want to switch to Avalon. :-)

Tom Jordahl

View raw message