commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berin Loritsch" <blorit...@apache.org>
Subject RE: [CLI] Feature requests and submissions
Date Thu, 01 Aug 2002 12:58:37 GMT
> 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!

Now, about having more than one instance of the same option....


--
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