commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Keyes <j...@mac.com>
Subject RE: [CLI] Feature requests and submissions
Date Thu, 01 Aug 2002 13:29:10 GMT
On Thu, 2002-08-01 at 13:58, Berin Loritsch wrote:
> > From: John Keyes [mailto:jbjk@mac.com] 
> > Sent: Wednesday, July 31, 2002 7:15 PM
> > To: Jakarta Commons Developers List
> > Subject: Re: [CLI] Feature requests and submissions
> > 
> > 
> > Actually, after looking at the impl of CommandLine I decided 
> > to tidy it up a bit.  This piece of tidy up gave me the 
> > ability to modify the iterator ability.
> > 
> > So the example in the previous mail can now be done as follows:
> > 
> > // create options object
> > Options options = ...;
> > 
> > CommandLineParser parser = CommandLineParserFactory.newParser();
> > CommandLine line = parser.parse( options, args );
> > 
> > Iterator iter = line.iterator();
> > while( iter.hasNext() ) {
> >     Option opt = iter.next().toString();
> >     String value = opt.getValue( );
> >     String value = opt.getValue( opt, "default value" );
> >     String[] values = opt.getValues( opt );
> >     Object obj = opt.getType( opt );
> > }
> > 
> > I can also provide an iterator for the opt values but I don't 
> > think this is necessary with the above approach.
> 
> 
> Much better!
BTW, I'll add a toOptionArray method also so it will
better resemble the Avalon way.

-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