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
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]