axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Rineholt" <rineh...@us.ibm.com>
Subject Re: proposed: CLI Args improvement
Date Mon, 10 Sep 2001 16:49:00 GMT
Regarding -- or just - I would suggest investigating other Apache offerings
add see if there is any precedents set  and follow those.

Rick Rineholt
"The truth is out there...  All you need is a better search engine!"

rineholt@us.ibm.com



Berin Loritsch <bloritsch@apache.org> on 09/10/2001 12:06:37 PM

Please respond to axis-dev@xml.apache.org

To:   "avalon-dev@jakarta.apache.org" <avalon-dev@jakarta.apache.org>, Axis
      Development <axis-dev@xml.apache.org>
cc:
Subject:  proposed: CLI Args improvement



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

or

$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

or

$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:
---------------------------------
FYI
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:
 -v
 --verbose
instead of what we currently have:
  -v[erbose]

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



Mime
View raw message