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 Sun, 04 Aug 2002 00:47:46 GMT
I have just commited the following changes:

  o  added getOptions method that returns an array of processed Options
  o  added hasArg( int ) method to specify the number of arguments an
      option can take.
  o  refactored argument value handling in the parsers
  o  refactored Option so all argument handling is based on one member

Check out the ValuesTest for examples of using the hasArg( int ) method.

Cheers,
-John K

On Friday, August 2, 2002, at 01:48 , Berin Loritsch wrote:

>> From: John Keyes [mailto:jbjk@mac.com]
>>
>> I have added the array method, as someone may prefer the
>> array approach to the Collections one.
>
> I threw together the array method to assist me trying to convert the
> Avalon CLI testcase to use Commons.  I can send you what I have so far
> off line--but it is incomplete, won't compile, etc.  I am having issues
> with Maven.  Let me know if you are interested.  Who knows, you might
> be able to clean it up a lot better than I could.
>
> Here is the diff for the array method:
>
> ------------------------------------------------------------------------
> ----
>
> ? src/test/org/apache/commons/cli/ExcaliburCLICompatTest.java
> Index: src/java/org/apache/commons/cli/CommandLine.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/CommandLin
> e.java,v
> retrieving revision 1.4
> cvs server: Diffing src/test/org/apache/commons
> diff -b -u -r1.4 CommandLine.java
> --- src/java/org/apache/commons/cli/CommandLine.java	31 Jul 2002
> 22:24:29 -0000	1.4
> cvs server: Diffing src/test/org/apache/commons/cli
> cvs server: Diffing xdocs
> +++ src/java/org/apache/commons/cli/CommandLine.java	2 Aug 2002
> 13:42:51 -0000
> @@ -64,6 +64,7 @@
>  import java.util.HashMap;
>  import java.util.Iterator;
>  import java.util.List;
> +import java.util.ArrayList;
>  import java.util.LinkedList;
>  import java.util.Map;
>
> @@ -207,5 +208,22 @@
>      public Iterator iterator( ) {
>          return options.values().iterator();
>      }
> +
> +    /**
> +     * <p>Returns a List of Options in the CommandLine.</p>
> +     *
> +     * @return a <code>List</code> over the processed {@link Option}
> +     * members of this {@link CommandLine}
> +     */
> +     public List getOptionList() {
> +         List optionList = new ArrayList(options.values().size());
> +
> +         Iterator it = options.values().iterator();
> +         while (it.hasNext()) {
> +             optionList.add( it.next() );
> +         }
> +
> +         return optionList;
> +     }
>
>  }
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-
> help@jakarta.apache.org>
>


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