On Tue, 11 Sep 2001 02:06, Berin Loritsch wrote:
> Would it be possible to extend the CLI package in excalibur to
> have a CLI Strategy?
possible? yes.
> 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") };
Personally I would like to see something more like
CLOptionDescriptor optionDescriptors = new CLOptionDescriptor[] {
new CLOptionDescriptor( new String[] { "version", "ve" }, 'v',...),
new CLOptionDescriptor(new String[] { "valid", "va" }, 'V',...)
};
Because as a program grows more options will be added that could quite
conceivably alter minimum discerning string which means addition of option
changes multiple options which is a *bad* idea ;)
Allowing multiple Long forms is much better IMHO
> By simply switching the strategy to AVALON_STRATEGY (above), we can perform
> the following calls:
Instead of passing a strategy to parser (as I would say the parser *is* the
strategy) I would make another parser class (maybe JavaCLIParser) and use
that directly. (Or alternatively use it via utility methods of CLIUtil or
something). Maybe they could both return a ParserResults or something.
Re: The "java" style
The problem is one of consistency. The "java" style is not consistent. For
instance in some java apps "uvf" is 3 options while in others it would be
considered one long option. ie -Dblah is often seen as one option with an
argument however the "java" style would also allow it to be a single long
option or multiple short options in a completely application specific manner.
Theres even more hell to pay with options like -Dblah=blee. There is also no
way in the "java" style to escape -'s which has bitten me a few times.
> 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]
After the above inconsistency issues are worked out you could implement
something like that I guess. However the code in CLIParser is extremely ...
errr ... messy ;) It would probably best just to start a new JavaCLIParser
from scratch and reuse the option definitions and utility methods etc.
--
Cheers,
Pete
------------------------------------------------------------
militant agnostic: i don't know, and you don't know either.
------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]