commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roxspr...@apache.org
Subject svn commit: r209516 [4/4] - in /jakarta/commons/proper/cli/branches/CLI_1_BRANCH: ./ src/conf/ src/java/org/apache/commons/cli/ src/media/ src/test/org/apache/commons/cli/ xdocs/ xdocs/images/ xdocs/style/
Date Wed, 06 Jul 2005 21:34:30 GMT
Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/PosixParser.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/PosixParser.java?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/PosixParser.java (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/PosixParser.java Wed Jul  6 14:34:26 2005
@@ -1,70 +1,23 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//cli/src/java/org/apache/commons/cli/PosixParser.java,v 1.11 2002/09/19 22:59:43 jkeyes Exp $
- * $Revision: 1.11 $
- * $Date: 2002/09/19 22:59:43 $
- *
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- *    any, must include the following acknowlegement:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowlegement may appear in the software itself,
- *    if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Commons", and "Apache Software
- *    Foundation" must not be used to endorse or promote products derived
- *    from this software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- *    nor may "Apache" appear in their names without prior written
- *    permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.commons.cli;
 
-import java.util.Arrays;
 import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Arrays;
 import java.util.Iterator;
-import java.util.Map;
 
 /**
  * The class PosixParser provides an implementation of the 
@@ -72,16 +25,19 @@
  *
  * @author John Keyes (john at integralsource.com)
  * @see Parser
- * @version $Revision: 1.11 $
+ * @version $Revision$
  */
 public class PosixParser extends Parser {
 
     /** holder for flattened tokens */
     private ArrayList tokens = new ArrayList();
+
     /** specifies if bursting should continue */
     private boolean eatTheRest;
+
     /** holder for the current option */
     private Option currentOption;
+
     /** the command line Options */
     private Options options;
 
@@ -90,7 +46,8 @@
      * all of <code>tokens</code> entries, set <code>eatTheRest</code>
      * to false and set <code>currentOption</code> to null.</p>
      */
-    private void init() {
+    private void init()
+    {
         eatTheRest = false;
         tokens.clear();
         currentOption = null;
@@ -121,7 +78,7 @@
      *  characters in length and the first character is "<b>-</b>" then
      *  we need to burst the entry to determine its constituents.  For more
      *  information on the bursting algorithm see 
-     *  {@link PosixParser#burstToken( String, boolean) burstToken}.</li>
+     *  {@link PosixParser#burstToken(String, boolean) burstToken}.</li>
      *  <li>if the current <code>arguments</code> entry is not handled 
      *  by any of the previous rules, then the entry is added to the list
      *  of processed tokens.</li>
@@ -134,61 +91,75 @@
      * when an non option is found.
      * @return The flattened <code>arguments</code> String array.
      */
-    protected String[] flatten( Options options, 
-                                String[] arguments, 
-                                boolean stopAtNonOption )
+    protected String[] flatten(Options options, String[] arguments, 
+                               boolean stopAtNonOption)
     {
         init();
         this.options = options;
 
         // an iterator for the command line tokens
-        Iterator iter = Arrays.asList( arguments ).iterator();
+        Iterator iter = Arrays.asList(arguments).iterator();
         String token = null;
-        
-        // process each command line token
-        while ( iter.hasNext() ) {
 
+        // process each command line token
+        while (iter.hasNext())
+        {
             // get the next command line token
             token = (String) iter.next();
 
             // handle SPECIAL TOKEN
-            if( token.startsWith( "--" ) ) {
-                if( token.indexOf( '=' ) != -1 ) {
-                    tokens.add( token.substring( 0, token.indexOf( '=' ) ) );
-                    tokens.add( token.substring( token.indexOf( '=' ) + 1,
-                                                 token.length() ) );
+            if (token.startsWith("--"))
+            {
+                if (token.indexOf('=') != -1)
+                {
+                    tokens.add(token.substring(0, token.indexOf('=')));
+                    tokens.add(token.substring(token.indexOf('=') + 1, 
+                                               token.length()));
+                }
+                else
+                {
+                    tokens.add(token);
                 }
-                else {
-                    tokens.add( token );
-                }	
             }
+
             // single hyphen
-            else if( "-".equals( token ) ) {
-                processSingleHyphen( token );
+            else if ("-".equals(token))
+            {
+                processSingleHyphen(token);
             }
-            else if( token.startsWith( "-" ) ) {
+            else if (token.startsWith("-"))
+            {
                 int tokenLength = token.length();
-                if( tokenLength == 2 ) {
-                    processOptionToken( token, stopAtNonOption );
+
+                if (tokenLength == 2)
+                {
+                    processOptionToken(token, stopAtNonOption);
+                }
+                else if (options.hasOption(token)) {
+                	tokens.add(token);
                 }
                 // requires bursting
-                else {
-                    burstToken( token, stopAtNonOption );
+                else
+                {
+                    burstToken(token, stopAtNonOption);
                 }
             }
-            else {
-                if( stopAtNonOption ) {
-                    process( token );
+            else
+            {
+                if (stopAtNonOption)
+                {
+                    process(token);
                 }
-                else {
-                    tokens.add( token );
+                else
+                {
+                    tokens.add(token);
                 }
             }
 
-            gobble( iter );
+            gobble(iter);
         }
 
-        return (String[])tokens.toArray( new String[] {} );
+        return (String[]) tokens.toArray(new String[] {  });
     }
 
     /**
@@ -196,10 +167,13 @@
      *
      * @param iter An iterator over the remaining tokens
      */
-    private void gobble( Iterator iter ) {
-        if( eatTheRest ) {
-            while( iter.hasNext() ) {
-                tokens.add( iter.next() );
+    private void gobble(Iterator iter)
+    {
+        if (eatTheRest)
+        {
+            while (iter.hasNext())
+            {
+                tokens.add(iter.next());
             }
         }
     }
@@ -217,20 +191,25 @@
      *
      * @param value The current token
      */
-    private void process( String value ) {
-        if( currentOption != null && currentOption.hasArg() ) {
-            if( currentOption.hasArg() ) {
-                tokens.add( value );
+    private void process(String value)
+    {
+        if ((currentOption != null) && currentOption.hasArg())
+        {
+            if (currentOption.hasArg())
+            {
+                tokens.add(value);
                 currentOption = null;
             }
-            else if (currentOption.hasArgs() ) {
-                tokens.add( value );
+            else if (currentOption.hasArgs())
+            {
+                tokens.add(value);
             }
         }
-        else {
+        else
+        {
             eatTheRest = true;
-            tokens.add( "--" );
-            tokens.add( value );
+            tokens.add("--");
+            tokens.add(value);
         }
     }
 
@@ -240,8 +219,9 @@
      *
      * @param hyphen The hyphen token
      */
-    private void processSingleHyphen( String hyphen ) {
-        tokens.add( hyphen );
+    private void processSingleHyphen(String hyphen)
+    {
+        tokens.add(hyphen);
     }
 
     /**
@@ -256,12 +236,15 @@
      * @param stopAtNonOption Specifies whether flattening should halt
      * at the first non option.
      */
-    private void processOptionToken( String token, boolean stopAtNonOption ) {
-        if( this.options.hasOption( token ) ) {
-            currentOption = this.options.getOption( token );
-            tokens.add( token );
+    private void processOptionToken(String token, boolean stopAtNonOption)
+    {
+        if (this.options.hasOption(token))
+        {
+            currentOption = this.options.getOption(token);
+            tokens.add(token);
         }
-        else if( stopAtNonOption ) {
+        else if (stopAtNonOption)
+        {
             eatTheRest = true;
         }
     }
@@ -270,7 +253,7 @@
      * <p>Breaks <code>token</code> into its constituent parts
      * using the following algorithm.
      * <ul>
-     *  <li>ignore the first character ("<b>-</b>" )</li>
+     *  <li>ignore the first character ("<b>-</b>")</li>
      *  <li>foreach remaining character check if an {@link Option}
      *  exists with that id.</li>
      *  <li>if an {@link Option} does exist then add that character
@@ -287,27 +270,39 @@
      *  character prepended with "<b>-</b>".</li>
      * </ul>
      * </p>
+     *
+     * @param token The current token to be <b>burst</b>
+     * @param stopAtNonOption Specifies whether to stop processing
+     * at the first non-Option encountered.
      */
-    protected void burstToken( String token, boolean stopAtNonOption ) {
+    protected void burstToken(String token, boolean stopAtNonOption)
+    {
         int tokenLength = token.length();
 
-        for( int i = 1; i < tokenLength; i++) {
-            String ch = String.valueOf( token.charAt( i ) );
-            boolean hasOption = options.hasOption( ch );
-
-            if( hasOption ) {
-                tokens.add( "-" + ch );
-                currentOption = options.getOption( ch );
-                if( currentOption.hasArg() && token.length()!=i+1 ) {
-                    tokens.add( token.substring( i+1 ) );
+        for (int i = 1; i < tokenLength; i++)
+        {
+            String ch = String.valueOf(token.charAt(i));
+            boolean hasOption = options.hasOption(ch);
+
+            if (hasOption)
+            {
+                tokens.add("-" + ch);
+                currentOption = options.getOption(ch);
+
+                if (currentOption.hasArg() && (token.length() != (i + 1)))
+                {
+                    tokens.add(token.substring(i + 1));
+
                     break;
                 }
             }
-            else if( stopAtNonOption ) {
-                process( token.substring( i ) );
+            else if (stopAtNonOption)
+            {
+                process(token.substring(i));
             }
-            else {
-                tokens.add( "-" + ch );
+            else
+            {
+                tokens.add("-" + ch);
             }
         }
     }

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/PosixParser.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Jul  6 14:34:26 2005
@@ -1 +1 @@
-author date id revision
+Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/TypeHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/TypeHandler.java?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/TypeHandler.java (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/TypeHandler.java Wed Jul  6 14:34:26 2005
@@ -1,69 +1,25 @@
 /*
- * $Header: /home/cvs/jakarta-commons-sandbox/cli/src/java/org/apache/commons/cli/TypeHandler.java,v 1.2 2002/06/06 22:49:36 bayard Exp $
- * $Revision: 1.2 $
- * $Date: 2002/06/06 22:49:36 $
- *
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- *    any, must include the following acknowlegement:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowlegement may appear in the software itself,
- *    if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Commons", and "Apache Software
- *    Foundation" must not be used to endorse or promote products derived
- *    from this software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- *    nor may "Apache" appear in their names without prior written
- *    permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
 package org.apache.commons.cli;
 
 import java.io.File;
-import java.net.URL;
+
 import java.net.MalformedURLException;
+import java.net.URL;
+
 import java.util.Date;
 
 import org.apache.commons.lang.NumberUtils;
@@ -75,8 +31,8 @@
   * alreayd. BeanUtils I think.
   *
   * @author Henri Yandell (bayard @ generationjava.com)
-  * @version $Revision: 1.2 $
-  */    
+  * @version $Revision$
+  */
 public class TypeHandler {
 
     /**
@@ -88,8 +44,9 @@
      * @return The instance of <code>obj</code> initialised with
      * the value of <code>str</code>.
      */
-    public static Object createValue(String str, Object obj) {
-        return createValue(str, (Class)obj);
+    public static Object createValue(String str, Object obj)
+    {
+        return createValue(str, (Class) obj);
     }
 
     /**
@@ -101,34 +58,46 @@
      * @return The instance of <code>clazz</code> initialised with
      * the value of <code>str</code>.
      */
-    public static Object createValue(String str, Class clazz) {
-        if( PatternOptionBuilder.STRING_VALUE == clazz) {
+    public static Object createValue(String str, Class clazz)
+    {
+        if (PatternOptionBuilder.STRING_VALUE == clazz)
+        {
             return str;
-        } else
-        if( PatternOptionBuilder.OBJECT_VALUE == clazz) {
+        }
+        else if (PatternOptionBuilder.OBJECT_VALUE == clazz)
+        {
             return createObject(str);
-        } else
-        if( PatternOptionBuilder.NUMBER_VALUE == clazz) {
+        }
+        else if (PatternOptionBuilder.NUMBER_VALUE == clazz)
+        {
             return createNumber(str);
-        } else
-        if( PatternOptionBuilder.DATE_VALUE   == clazz) {
+        }
+        else if (PatternOptionBuilder.DATE_VALUE == clazz)
+        {
             return createDate(str);
-        } else
-        if( PatternOptionBuilder.CLASS_VALUE  == clazz) {
+        }
+        else if (PatternOptionBuilder.CLASS_VALUE == clazz)
+        {
             return createClass(str);
-        } else
-        if( PatternOptionBuilder.FILE_VALUE   == clazz) {
+        }
+        else if (PatternOptionBuilder.FILE_VALUE == clazz)
+        {
             return createFile(str);
-        } else
-        if( PatternOptionBuilder.EXISTING_FILE_VALUE   == clazz) {
+        }
+        else if (PatternOptionBuilder.EXISTING_FILE_VALUE == clazz)
+        {
             return createFile(str);
-        } else
-        if( PatternOptionBuilder.FILES_VALUE  == clazz) {
+        }
+        else if (PatternOptionBuilder.FILES_VALUE == clazz)
+        {
             return createFiles(str);
-        } else
-        if( PatternOptionBuilder.URL_VALUE    == clazz) {
+        }
+        else if (PatternOptionBuilder.URL_VALUE == clazz)
+        {
             return createURL(str);
-        } else {
+        }
+        else
+        {
             return null;
         }
     }
@@ -137,27 +106,42 @@
       * <p>Create an Object from the classname and empty constructor.</p>
       *
       * @param str the argument value
-      * @return the initialised object, or null if it couldn't create the Object.
+      * @return the initialised object, or null if it couldn't create 
+      * the Object.
       */
-    public static Object createObject(String str) {
+    public static Object createObject(String str)
+    {
         Class cl = null;
-        try {
+
+        try
+        {
             cl = Class.forName(str);
-        } catch (ClassNotFoundException cnfe) {
-            System.err.println("Unable to find: "+str);
+        }
+        catch (ClassNotFoundException cnfe)
+        {
+            System.err.println("Unable to find: " + str);
+
             return null;
         }
 
         Object instance = null;
 
-        try {
+        try
+        {
             instance = cl.newInstance();
-        } catch (InstantiationException cnfe) {
-            System.err.println("InstantiationException; Unable to create: "+str);
+        }
+        catch (InstantiationException cnfe)
+        {
+            System.err.println("InstantiationException; Unable to create: "
+                               + str);
+
             return null;
         }
-        catch (IllegalAccessException cnfe) {
-            System.err.println("IllegalAccessException; Unable to create: "+str);
+        catch (IllegalAccessException cnfe)
+        {
+            System.err.println("IllegalAccessException; Unable to create: "
+                               + str);
+
             return null;
         }
 
@@ -171,13 +155,18 @@
      * @return the number represented by <code>str</code>, if <code>str</code>
      * is not a number, null is returned.
      */
-    public static Number createNumber(String str) {
+    public static Number createNumber(String str)
+    {
         // Needs to be able to create
-        try {
+        try
+        {
             // do searching for decimal point etc, but atm just make an Integer
             return NumberUtils.createNumber(str);
-        } catch (NumberFormatException nfe) {
+        }
+        catch (NumberFormatException nfe)
+        {
             System.err.println(nfe.getMessage());
+
             return null;
         }
     }
@@ -188,11 +177,16 @@
      * @param str the class name
      * @return The class if it is found, otherwise return null
      */
-    public static Class createClass(String str) {
-        try {
+    public static Class createClass(String str)
+    {
+        try
+        {
             return Class.forName(str);
-        } catch (ClassNotFoundException cnfe) {
-            System.err.println("Unable to find: "+str);
+        }
+        catch (ClassNotFoundException cnfe)
+        {
+            System.err.println("Unable to find: " + str);
+
             return null;
         }
     }
@@ -204,11 +198,15 @@
      * @return The date if <code>str</code> is a valid date string,
      * otherwise return null.
      */
-    public static Date createDate(String str) {
+    public static Date createDate(String str)
+    {
         Date date = null;
-        if(date == null) {
-            System.err.println("Unable to parse: "+str);
+
+        if (date == null)
+        {
+            System.err.println("Unable to parse: " + str);
         }
+
         return date;
     }
 
@@ -219,11 +217,16 @@
      * @return The URL is <code>str</code> is well-formed, otherwise
      * return null.
      */
-    public static URL createURL(String str) {
-        try {
+    public static URL createURL(String str)
+    {
+        try
+        {
             return new URL(str);
-        } catch (MalformedURLException mue) {
-            System.err.println("Unable to parse: "+str);
+        }
+        catch (MalformedURLException mue)
+        {
+            System.err.println("Unable to parse: " + str);
+
             return null;
         }
     }
@@ -234,7 +237,8 @@
      * @param str the File location
      * @return The file represented by <code>str</code>.
      */
-    public static File createFile(String str) {
+    public static File createFile(String str)
+    {
         return new File(str);
     }
 
@@ -244,10 +248,10 @@
      * @param str the paths to the files
      * @return The File[] represented by <code>str</code>.
      */
-    public static File[] createFiles(String str) {
-// to implement/port:
-//        return FileW.findFiles(str);
+    public static File[] createFiles(String str)
+    {
+        // to implement/port:
+        //        return FileW.findFiles(str);
         return null;
     }
-
-}
+}
\ No newline at end of file

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/TypeHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/UnrecognizedOptionException.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/UnrecognizedOptionException.java?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/UnrecognizedOptionException.java (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/UnrecognizedOptionException.java Wed Jul  6 14:34:26 2005
@@ -1,64 +1,18 @@
 /*
- * $Header: /home/cvs/jakarta-commons-sandbox/cli/src/java/org/apache/commons/cli/UnrecognizedOptionException.java,v 1.2 2002/06/06 09:37:26 jstrachan Exp $
- * $Revision: 1.2 $
- * $Date: 2002/06/06 09:37:26 $
- *
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- *    any, must include the following acknowlegement:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowlegement may appear in the software itself,
- *    if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Commons", and "Apache Software
- *    Foundation" must not be used to endorse or promote products derived
- *    from this software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- *    nor may "Apache" appear in their names without prior written
- *    permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
 package org.apache.commons.cli;
 
 /** 
@@ -66,17 +20,19 @@
  * option was seen.<p>
  *
  * @author bob mcwhiter (bob @ werken.com)
- * @version $Revision: 1.2 $
+ * @version $Revision$
  */
-public class UnrecognizedOptionException extends ParseException {
-    
+public class UnrecognizedOptionException
+    extends ParseException {
+
     /** 
      * <p>Construct a new <code>UnrecognizedArgumentException</code> 
      * with the specified detail message.</p>
      *
      * @param message the detail message
      */
-    public UnrecognizedOptionException( String message ) {
-        super( message );
+    public UnrecognizedOptionException(String message)
+    {
+        super(message);
     }
-}
+}
\ No newline at end of file

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/UnrecognizedOptionException.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/Util.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/Util.java?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/Util.java (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/Util.java Wed Jul  6 14:34:26 2005
@@ -1,62 +1,17 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//cli/src/java/org/apache/commons/cli/Util.java,v 1.1 2002/11/18 08:41:26 jkeyes Exp $
- * $Revision: 1.1 $
- * $Date: 2002/11/18 08:41:26 $
- *
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- *    any, must include the following acknowlegement:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowlegement may appear in the software itself,
- *    if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Commons", and "Apache Software
- *    Foundation" must not be used to endorse or promote products derived
- *    from this software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- *    nor may "Apache" appear in their names without prior written
- *    permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.commons.cli;
 
@@ -67,13 +22,45 @@
  */
 class Util {
 
-    static String stripLeadingHyphens( String str ) {
-        if( str.startsWith( "--" ) ) {
-            return str.substring( 2, str.length() );
+    /**
+     * <p>Remove the hyphens from the begining of <code>str</code> and
+     * return the new String.</p>
+     *
+     * @param str The string from which the hyphens should be removed.
+     *
+     * @return the new String.
+     */
+    static String stripLeadingHyphens(String str)
+    {
+        if (str.startsWith("--"))
+        {
+            return str.substring(2, str.length());
+        }
+        else if (str.startsWith("-"))
+        {
+            return str.substring(1, str.length());
+        }
+
+        return str;
+    }
+
+    /**
+     * Remove the leading and trailing quotes from <code>str</code>.
+     * E.g. if str is '"one two"', then 'one two' is returned.
+     *
+     * @param str The string from which the leading and trailing quotes
+     * should be removed.
+     *
+     * @return The string without the leading and trailing quotes.
+     */
+    static String stripLeadingAndTrailingQuotes(String str)
+    {
+        if (str.startsWith("\"")) {
+            str = str.substring(1, str.length());
         }
-        else if ( str.startsWith( "-" ) ) {
-            return str.substring( 1, str.length() );
+        if (str.endsWith("\"")) {
+            str = str.substring(0, str.length()-1);
         }
         return str;
     }
-            }
\ No newline at end of file
+}
\ No newline at end of file

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/Util.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Jul  6 14:34:26 2005
@@ -1 +1 @@
-author date id revision
+Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/overview.html
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/java/org/apache/commons/cli/package.html
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ApplicationTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Jul  6 14:34:26 2005
@@ -1 +1 @@
-author date id revision
+Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ArgumentIsOptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ArgumentIsOptionTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/BugsTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/BugsTest.java?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/BugsTest.java (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/BugsTest.java Wed Jul  6 14:34:26 2005
@@ -10,6 +10,12 @@
 
 package org.apache.commons.cli;
 
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Properties;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -269,12 +275,30 @@
                                        .hasArg()
                                        .create( 'd' );
         options.addOption( dir );
-        try {
-            HelpFormatter formatter = new HelpFormatter();
-            formatter.printHelp( "dir", options );
+        
+        
+        final PrintStream oldSystemOut = System.out;
+        try{
+            final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+            final PrintStream print = new PrintStream(bytes);
+            
+            // capture this platform's eol symbol
+            print.println();
+            final String eol = bytes.toString();
+            bytes.reset();
+            
+            System.setOut(new PrintStream(bytes));
+            try {
+                HelpFormatter formatter = new HelpFormatter();
+                formatter.printHelp( "dir", options );
+            }
+            catch( Exception exp ) {
+                fail( "Unexpected Exception: " + exp.getMessage() );
+            }
+            assertEquals("usage: dir"+eol+" -d <arg>   dir"+eol,bytes.toString());
         }
-        catch( Exception exp ) {
-            fail( "Unexpected Exception: " + exp.getMessage() );
+        finally {
+            System.setOut(oldSystemOut);
         }
     }
 
@@ -343,4 +367,176 @@
             fail( "Unexpected exception: " + exp.getClass().getName() + ":" + exp.getMessage() );
         }
     }
+
+    public void test14786() throws Exception {
+        Option o = OptionBuilder.isRequired().withDescription("test").create("test");
+        Options opts = new Options();
+        opts.addOption(o);
+        opts.addOption(o);
+
+        CommandLineParser parser = new GnuParser();
+
+        String[] args = new String[] { "-test" };
+
+        CommandLine line = parser.parse( opts, args );
+        assertTrue( line.hasOption( "test" ) );
+    }
+
+    public void test15046() throws Exception {
+        CommandLineParser parser = new PosixParser();
+        final String[] CLI_ARGS = new String[] {"-z", "c"};
+        Option option = new Option("z", "timezone", true, 
+                                   "affected option");
+        Options cliOptions = new Options();
+        cliOptions.addOption(option);
+        parser.parse(cliOptions, CLI_ARGS);
+		
+        //now add conflicting option
+        cliOptions.addOption("c", "conflict", true, "conflict option");
+        CommandLine line = parser.parse(cliOptions, CLI_ARGS);
+        assertEquals( option.getValue(), "c" );
+        assertTrue( !line.hasOption("c") );
+    }
+
+    public void test15648() throws Exception {
+        CommandLineParser parser = new PosixParser();
+        final String[] args = new String[] { "-m", "\"Two Words\"" };
+        Option m = OptionBuilder.hasArgs().create("m");
+        Options options = new Options();
+        options.addOption( m );
+        CommandLine line = parser.parse( options, args );
+        assertEquals( "Two Words", line.getOptionValue( "m" ) );
+    }
+    
+    public void test27575() {
+    	Options options = PatternOptionBuilder.parsePattern("hc!<");
+    	assertNotNull(options);
+    	Option h = options.getOption("-h");
+    	assertNotNull(h);
+    	assertFalse(h.isRequired());
+    	Option c = options.getOption("-c");
+    	assertNotNull(c);
+    	assertTrue(c.isRequired());
+    }
+
+    public void test27635() {
+        Option help = new Option("h", "help", false, "print this message");
+        Option version = new Option("v", "version", false, "print version information");
+        Option newRun = new Option("n", "new", false, "Create NLT cache entries only for new items");
+        Option trackerRun = new Option("t", "tracker", false, "Create NLT cache entries only for tracker items");
+        
+        Option timeLimit = OptionBuilder.withLongOpt("limit")
+                                        .hasArg()
+                                        .withValueSeparator()
+                                        .withDescription("Set time limit for execution, in mintues")
+                                        .create("l");
+        
+        Option age = OptionBuilder.withLongOpt("age")
+                                        .hasArg()
+                                        .withValueSeparator()
+                                        .withDescription("Age (in days) of cache item before being recomputed")
+                                        .create("a");
+        
+        Option server = OptionBuilder.withLongOpt("server")
+                                        .hasArg()
+                                        .withValueSeparator()
+                                        .withDescription("The NLT server address")
+                                        .create("s");
+        
+        Option numResults = OptionBuilder.withLongOpt("results")
+                                        .hasArg()
+                                        .withValueSeparator()
+                                        .withDescription("Number of results per item")
+                                        .create("r");
+        
+        Option configFile = OptionBuilder.withLongOpt("config")
+                                        .hasArg()
+                                        .withValueSeparator()
+                                        .withDescription("Use the specified configuration file")
+                                        .create();
+        
+        Options mOptions = new Options();
+        mOptions.addOption(help);
+        mOptions.addOption(version);
+        mOptions.addOption(newRun);
+        mOptions.addOption(trackerRun);
+        mOptions.addOption(timeLimit);
+        mOptions.addOption(age);
+        mOptions.addOption(server);
+        mOptions.addOption(numResults);
+        mOptions.addOption(configFile);
+        
+        HelpFormatter formatter = new HelpFormatter();
+        final String EOL = System.getProperty("line.separator");
+        StringWriter out = new StringWriter();
+        formatter.printHelp(new PrintWriter(out),80,"commandline","header",mOptions,2,2,"footer",true);
+        assertEquals(
+                "usage: commandline [--config <arg>] [-r <arg>] [-a <arg>] [-h] [-t] [-n] [-l"+EOL+
+                "       <arg>] [-s <arg>] [-v]"+EOL+
+                "header"+EOL+
+                "  -a,--age <arg>      Age (in days) of cache item before being recomputed"+EOL+
+                "  -h,--help           print this message"+EOL+
+                "  -l,--limit <arg>    Set time limit for execution, in mintues"+EOL+
+                "  -n,--new            Create NLT cache entries only for new items"+EOL+
+                "     --config <arg>   Use the specified configuration file"+EOL+
+                "  -r,--results <arg>  Number of results per item"+EOL+
+                "  -s,--server <arg>   The NLT server address"+EOL+
+                "  -t,--tracker        Create NLT cache entries only for tracker items"+EOL+
+                "  -v,--version        print version information"+EOL+
+                "footer"+EOL
+                ,out.toString());
+    }
+    
+    public void test31148() throws ParseException {
+        Option multiArgOption = new Option("o","option with multiple args");
+        multiArgOption.setArgs(1);
+        
+        Options options = new Options();
+        options.addOption(multiArgOption);
+        
+        Parser parser = new PosixParser();
+        String[] args = new String[]{};
+        Properties props = new Properties();
+        props.setProperty("o","ovalue");
+        CommandLine cl = parser.parse(options,args,props);
+        
+        assertTrue(cl.hasOption('o'));
+        assertEquals("ovalue",cl.getOptionValue('o'));
+    }
+    
+    public void test21215() {
+        Options options = new Options();
+        HelpFormatter formatter = new HelpFormatter();
+        String SEP = System.getProperty("line.separator");
+        String header = SEP+"Header";
+        String footer = "Footer";
+        StringWriter out = new StringWriter();
+        formatter.printHelp(new PrintWriter(out),80, "foobar", header, options, 2, 2, footer, true);
+        assertEquals(
+                "usage: foobar"+SEP+
+                ""+SEP+
+                "Header"+SEP+
+                ""+SEP+
+                "Footer"+SEP
+                ,out.toString());
+    }
+    
+    public void test19383() {
+        Options options = new Options();
+        options.addOption(new Option("a","aaa",false,"aaaaaaa"));
+        options.addOption(new Option(null,"bbb",false,"bbbbbbb"));
+        options.addOption(new Option("c",null,false,"ccccccc"));
+        
+        HelpFormatter formatter = new HelpFormatter();
+        String SEP = System.getProperty("line.separator");
+        StringWriter out = new StringWriter();
+        formatter.printHelp(new PrintWriter(out),80, "foobar", "", options, 2, 2, "", true);
+        assertEquals(
+                "usage: foobar [-a] [-c] [--bbb]"+SEP+
+                "  -a,--aaa  aaaaaaa"+SEP+
+                "  -c        ccccccc"+SEP+
+                "     --bbb  bbbbbbb"+SEP
+                ,out.toString());
+    }
+
 }

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/BugsTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Jul  6 14:34:26 2005
@@ -1 +1 @@
-author date id revision
+Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/BuildTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/GnuParseTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Jul  6 14:34:26 2005
@@ -1 +1 @@
-author date id revision
+Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/HelpFormatterExamples.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/LongOptionWithShort.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/LongOptionWithShort.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/OptionBuilderTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Jul  6 14:34:26 2005
@@ -1 +1 @@
-author date id revision
+Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/OptionGroupTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/OptionGroupTest.java?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/OptionGroupTest.java (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/OptionGroupTest.java Wed Jul  6 14:34:26 2005
@@ -5,7 +5,7 @@
  * version 1.1, a copy of which has been included with this distribution in
  * the LICENSE file.
  * 
- * $Id: OptionGroupTest.java,v 1.1 2002/04/23 16:08:02 jstrachan Exp $
+ * $Id$
  */
 
 package org.apache.commons.cli;
@@ -16,7 +16,7 @@
 
 /**
  * @author John Keyes (john at integralsource.com)
- * @version $Revision: 1.1 $
+ * @version $Revision$
  */
 public class OptionGroupTest extends TestCase
 {

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/OptionGroupTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/OptionsTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/OptionsTest.java?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/OptionsTest.java (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/OptionsTest.java Wed Jul  6 14:34:26 2005
@@ -1,62 +1,17 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//cli/src/test/org/apache/commons/cli/OptionsTest.java,v 1.1 2002/11/19 00:16:18 jkeyes Exp $
- * $Revision: 1.1 $
- * $Date: 2002/11/19 00:16:18 $
- *
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- *    any, must include the following acknowlegement:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowlegement may appear in the software itself,
- *    if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Commons", and "Apache Software
- *    Foundation" must not be used to endorse or promote products derived
- *    from this software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- *    nor may "Apache" appear in their names without prior written
- *    permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.commons.cli;
 
@@ -69,7 +24,7 @@
 
 /**
  * @author Rob Oxspring roxspring@apache.org
- * @version $Revision: 1.1 $
+ * @version $Revision$
  */
 public class OptionsTest extends TestCase
 {

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/OptionsTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Jul  6 14:34:26 2005
@@ -1 +1 @@
-author date id revision
+Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ParseRequiredTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ParseRequiredTest.java?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ParseRequiredTest.java (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ParseRequiredTest.java Wed Jul  6 14:34:26 2005
@@ -5,7 +5,7 @@
  * version 1.1, a copy of which has been included with this distribution in
  * the LICENSE file.
  * 
- * $Id: ParseRequiredTest.java,v 1.1 2002/04/23 16:08:02 jstrachan Exp $
+ * $Id$
  */
 
 package org.apache.commons.cli;
@@ -16,7 +16,7 @@
 
 /**
  * @author John Keyes (john at integralsource.com)
- * @version $Revision: 1.1 $
+ * @version $Revision$
  */
 public class ParseRequiredTest extends TestCase
 {

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ParseRequiredTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ParseTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/PatternOptionBuilderTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/TestHelpFormatter.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/TestHelpFormatter.java?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/TestHelpFormatter.java (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/TestHelpFormatter.java Wed Jul  6 14:34:26 2005
@@ -5,7 +5,7 @@
  * version 1.1, a copy of which has been included with this distribution in
  * the LICENSE file.
  * 
- * $Id: TestHelpFormatter.java,v 1.2 2002/05/17 11:44:32 jstrachan Exp $
+ * $Id$
  */
 package org.apache.commons.cli;
 
@@ -64,18 +64,18 @@
       String text = "This is a test.";
       String expected;
 
-      expected = "This is a" + hf.defaultNewLine + "test.";
+      expected = "This is a" + hf.getNewLine() + "test.";
       hf.renderWrappedText(sb, 12, 0, text);
       assertEquals("single line text", expected, sb.toString());
 
       sb.setLength(0);
-      expected = "This is a" + hf.defaultNewLine + "    test.";
+      expected = "This is a" + hf.getNewLine() + "    test.";
       hf.renderWrappedText(sb, 12, 4, text);
       assertEquals("single line padded text", expected, sb.toString());
 
       text =
-         "aaaa aaaa aaaa" + hf.defaultNewLine +
-         "aaaaaa" + hf.defaultNewLine +
+         "aaaa aaaa aaaa" + hf.getNewLine() +
+         "aaaaaa" + hf.getNewLine() +
          "aaaaa";
 
       expected = text;
@@ -84,8 +84,8 @@
       assertEquals("multi line text", expected, sb.toString());
 
       expected =
-         "aaaa aaaa aaaa" + hf.defaultNewLine +
-         "    aaaaaa" + hf.defaultNewLine +
+         "aaaa aaaa aaaa" + hf.getNewLine() +
+         "    aaaaaa" + hf.getNewLine() +
          "    aaaaa";
       sb.setLength(0);
       hf.renderWrappedText(sb, 16, 4, text);
@@ -111,7 +111,7 @@
 
        int nextLineTabStop = leftPad+descPad+"-a".length();
        expected =
-           lpad + "-a" + dpad + "aaaa aaaa aaaa" + hf.defaultNewLine +
+           lpad + "-a" + dpad + "aaaa aaaa aaaa" + hf.getNewLine() +
            hf.createPadding(nextLineTabStop) + "aaaa aaaa";
        sb.setLength(0);
        hf.renderOptions(sb, nextLineTabStop+17, options, leftPad, descPad);
@@ -126,7 +126,7 @@
 
        nextLineTabStop = leftPad+descPad+"-a,--aaa".length();
        expected =
-           lpad + "-a,--aaa" + dpad + "dddd dddd" + hf.defaultNewLine +
+           lpad + "-a,--aaa" + dpad + "dddd dddd" + hf.getNewLine() +
            hf.createPadding(nextLineTabStop) + "dddd dddd";
        sb.setLength(0);
        hf.renderOptions(sb, 25, options, leftPad, descPad);
@@ -136,9 +136,9 @@
            addOption("a", "aaa", false, "dddd dddd dddd dddd").
            addOption("b", false, "feeee eeee eeee eeee");
        expected =
-           lpad + "-a,--aaa" + dpad + "dddd dddd" + hf.defaultNewLine +
-           hf.createPadding(nextLineTabStop) + "dddd dddd" + hf.defaultNewLine +
-           lpad + "-b      " + dpad + "feeee eeee" + hf.defaultNewLine +
+           lpad + "-a,--aaa" + dpad + "dddd dddd" + hf.getNewLine() +
+           hf.createPadding(nextLineTabStop) + "dddd dddd" + hf.getNewLine() +
+           lpad + "-b      " + dpad + "feeee eeee" + hf.getNewLine() +
            hf.createPadding(nextLineTabStop) + "eeee eeee";
        sb.setLength(0);
        hf.renderOptions(sb, 25, options, leftPad, descPad);
@@ -160,7 +160,7 @@
        assertEquals("simple auto usage", expected, out.toString().trim());
        out.reset();
 
-       expected = "usage: app [-b] [-a]";
+       expected = "usage: app [-a] [-b]";
        options = new Options().addOption("a", false, "aaaa aaaa aaaa aaaa aaaa")
        .addOption("b", false, "bbb" );
        hf.printUsage( pw, 60, "app", options );

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/TestHelpFormatter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ValueTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ValueTest.java?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ValueTest.java (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ValueTest.java Wed Jul  6 14:34:26 2005
@@ -5,7 +5,7 @@
  * version 1.1, a copy of which has been included with this distribution in
  * the LICENSE file.
  * 
- * $Id: ValueTest.java,v 1.1 2001/12/19 18:16:25 jstrachan Exp $
+ * $Id$
  */
 
 package org.apache.commons.cli;
@@ -14,6 +14,7 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import java.util.Arrays;
 import java.util.Properties;
 
 public class ValueTest extends TestCase
@@ -73,6 +74,9 @@
         opts.addOption( OptionBuilder.hasOptionalArgs( )
                         .create( 'j' ) );
 
+        opts.addOption( OptionBuilder.hasArgs( ).withValueSeparator( ',' )
+                        .create( 'k' ) );
+
         String[] args = new String[] { "-a",
             "-b", "foo",
             "--c",
@@ -253,11 +257,14 @@
 
     public void testLongOptionalNArgValues()
     {
-        String[] args = new String[] { "--hide", "house", "hair", "head"
+        String[] args = new String[] { 
+            "--hide", "house", "hair", "head"
         };
+
+        CommandLineParser parser = new PosixParser();
+
         try
         {
-            CommandLineParser parser = new PosixParser();
             CommandLine cmd = parser.parse(opts,args);
             assertTrue( cmd.hasOption("hide") );
             assertEquals( "house", cmd.getOptionValue("hide") );
@@ -272,13 +279,15 @@
         }
     }
 
-    public void testPropertyValues()
+    public void testPropertyOptionSingularValue()
     {
         Properties properties = new Properties();
         properties.setProperty( "hide", "seek" );
+
+        CommandLineParser parser = new PosixParser();
+        
         try
         {
-            CommandLineParser parser = new PosixParser();
             CommandLine cmd = parser.parse(opts, null, properties);
             assertTrue( cmd.hasOption("hide") );
             assertEquals( "seek", cmd.getOptionValue("hide") );
@@ -288,7 +297,99 @@
         {
             fail("Cannot setUp() CommandLine: " + e.toString());
         }
+    }
+
+    public void testPropertyOptionFlags()
+    {
+        Properties properties = new Properties();
+        properties.setProperty( "a", "true" );
+        properties.setProperty( "c", "yes" );
+        properties.setProperty( "e", "1" );
+
+        CommandLineParser parser = new PosixParser();
+        
+        try
+        {
+            CommandLine cmd = parser.parse(opts, null, properties);
+            assertTrue( cmd.hasOption("a") );
+            assertTrue( cmd.hasOption("c") );
+            assertTrue( cmd.hasOption("e") );
+        }
+        catch (ParseException e)
+        {
+            fail("Cannot setUp() CommandLine: " + e.toString());
+        }
+
+        properties = new Properties();
+        properties.setProperty( "a", "false" );
+        properties.setProperty( "c", "no" );
+        properties.setProperty( "e", "0" );
+        try
+        {
+            CommandLine cmd = parser.parse(opts, null, properties);
+            assertTrue( !cmd.hasOption("a") );
+            assertTrue( !cmd.hasOption("c") );
+            assertTrue( !cmd.hasOption("e") );
+        }
+        catch (ParseException e)
+        {
+            fail("Cannot setUp() CommandLine: " + e.toString());
+        }
+
+        properties = new Properties();
+        properties.setProperty( "a", "TRUE" );
+        properties.setProperty( "c", "nO" );
+        properties.setProperty( "e", "TrUe" );
+        try
+        {
+            CommandLine cmd = parser.parse(opts, null, properties);
+            assertTrue( cmd.hasOption("a") );
+            assertTrue( !cmd.hasOption("c") );
+            assertTrue( cmd.hasOption("e") );
+        }
+        catch (ParseException e)
+        {
+            fail("Cannot setUp() CommandLine: " + e.toString());
+        }
+
+        properties = new Properties();
+        properties.setProperty( "a", "just a string" );
+        properties.setProperty( "e", "" );
+        try
+        {
+            CommandLine cmd = parser.parse(opts, null, properties);
+            assertTrue( !cmd.hasOption("a") );
+            assertTrue( !cmd.hasOption("c") );
+            assertTrue( !cmd.hasOption("e") );
+        }
+        catch (ParseException e)
+        {
+            fail("Cannot setUp() CommandLine: " + e.toString());
+        }
+
     } 
+
+    public void testPropertyOptionMultipleValues()
+    {
+        Properties properties = new Properties();
+        properties.setProperty( "k", "one,two" );
+
+        CommandLineParser parser = new PosixParser();
+        
+        String[] values = new String[] {
+            "one", "two"
+        };
+        try
+        {
+            CommandLine cmd = parser.parse(opts, null, properties);
+            assertTrue( cmd.hasOption("k") );
+            assertTrue( Arrays.equals( values, cmd.getOptionValues('k') ) );
+        }
+        catch (ParseException e)
+        {
+            fail("Cannot setUp() CommandLine: " + e.toString());
+        }
+    }
 
     public void testPropertyOverrideValues()
     {

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ValueTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ValuesTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ValuesTest.java?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ValuesTest.java (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ValuesTest.java Wed Jul  6 14:34:26 2005
@@ -5,7 +5,7 @@
  * version 1.1, a copy of which has been included with this distribution in
  * the LICENSE file.
  * 
- * $Id: ValueTest.java,v 1.1 2001/12/19 18:16:25 jstrachan Exp $
+ * $Id$
  */
 
 package org.apache.commons.cli;
@@ -192,8 +192,8 @@
         String[] values = new String[] { "key", "value", "key", "value" };
         assertTrue( _cmdline.hasOption( "j" ) );
         assertTrue( _cmdline.hasOption( 'j' ) );
-        assertTrue( _cmdline.getOptionValues( "j" ).length == 4);
-        assertTrue( _cmdline.getOptionValues( 'j' ).length == 4);
+        assertEquals( 4, _cmdline.getOptionValues( "j" ).length );
+        assertEquals( 4, _cmdline.getOptionValues( 'j' ).length );
         assertTrue( Arrays.equals( values, _cmdline.getOptionValues( "j" ) ) );
         assertTrue( Arrays.equals( values, _cmdline.getOptionValues( 'j' ) ) );
 

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/src/test/org/apache/commons/cli/ValuesTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/index.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/index.xml?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/index.xml (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/index.xml Wed Jul  6 14:34:26 2005
@@ -3,14 +3,12 @@
 <document>
 
  <properties>
-  <title></title>
+    <title>Introduction</title>
   <author email="jstrachan@apache.org">James Strachan</author>
  </properties>
 
 <body>
-
-<section name="CLI : Command Line Interface">
-
+    <section name="Jakarta Commons CLI">
 <p>
    The CLI library provides a simple and easy to use API for working
    with the command line arguments and options.</p>
@@ -22,8 +20,7 @@
      <li>Optz by John Keyes</li>
    </ul>
 </p>
-
 </section>
+  </body>
 
-</body>
 </document>

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/index.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/introduction.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/introduction.xml?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/introduction.xml (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/introduction.xml Wed Jul  6 14:34:26 2005
@@ -23,9 +23,9 @@
       <p>
         CLI uses the <a href="apidocs/org/apache/commons/cli/Options.html">
         Options</a> class, as a container for 
-        <a href="apidocs/org/apache/commons/cli/Options.html">
+        <a href="apidocs/org/apache/commons/cli/Option.html">
         Option</a> instances.  There are two ways to create
-        <code>Option</code>s in CLI.  One of them is via the constuctors,
+        <code>Option</code>s in CLI.  One of them is via the constructors,
         the other way is via the factory methods defined in 
         <code>Options</code>.
       </p>
@@ -64,17 +64,13 @@
       <p>
         The interrogation stage is where the application querys the
         <code>CommandLine</code> to decide what execution branch to
-        take depending on boolean options and to use the option values
+        take depending on boolean options and uses the option values
         to provide the application data.
       </p>
       <p>
         This stage is implemented in the user code.  The accessor methods 
         on <code>CommandLine</code> provide the interrogation capability
         to the user code.
-      </p>
-      <p>
-        The <a href="usage.html">Usage Scenarios</a> document provides examples
-        how to create an <code>Options</code> object.
       </p>
       <p>
         The result of the interrogation stage is that the user code 

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/introduction.xml
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Jul  6 14:34:26 2005
@@ -1 +1 @@
-author date id revision
+Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/navigation.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/navigation.xml?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/navigation.xml (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/navigation.xml Wed Jul  6 14:34:26 2005
@@ -1,14 +1,26 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE org.apache.commons.menus SYSTEM '../../commons-build/menus/menus.dtd'>
 <project name="CLI">
 
   <title>CLI</title>
 
   <body>
+    <links>
+      <item name="Jakarta Commons"                   
+            href="http://jakarta.apache.org/commons/"/>
+    </links>
+
     <menu name="User Documentation">
       <item name="Introduction"      href="/introduction.html"/>
       <item name="Usage Scenarios"   href="/usage.html"/>
       <item name="Option Properties" href="/properties.html"/>
       <item name="Download" href="http://jakarta.apache.org/builds/jakarta-commons/release/commons-cli/v1.0/"/>
     </menu>
+
+    <menu name="Developer Documentation">
+      <item name="Versions and Branches" href="/versions_and_branches.html"/>
+    </menu>
+    
+    &common-menus;
   </body>
 </project>

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/navigation.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/properties.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/properties.xml?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/properties.xml (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/properties.xml Wed Jul  6 14:34:26 2005
@@ -10,9 +10,9 @@
     <section name="Option Properties">
       <p>
         The following are the properties that each 
-        <a href="apidocs/org/apache/commons/cli/Options.html">Option</a> has.  All of these
+        <a href="apidocs/org/apache/commons/cli/Option.html">Option</a> has.  All of these
         can be set using the accessors or using the methods
-        defined on the
+        defined in the
         <a href="apidocs/org/apache/commons/cli/OptionBuilder.html">OptionBuilder</a>.
       </p>
       <table>

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/properties.xml
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Wed Jul  6 14:34:26 2005
@@ -1 +1 @@
-author date id revision
+Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/style/project.css
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/style/project.css
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/usage.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/usage.xml?rev=209516&r1=209515&r2=209516&view=diff
==============================================================================
--- jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/usage.xml (original)
+++ jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/usage.xml Wed Jul  6 14:34:26 2005
@@ -17,7 +17,7 @@
         <p>
           A boolean option is represented on a command line by the presence
           of the option, i.e. if the option is found then the option value
-          is true, otherwise the value is false.
+          is <code>true</code>, otherwise the value is <code>false</code>.
         </p>
         <p>
           The <code>DateApp</code> utility prints the current date to standard
@@ -28,7 +28,7 @@
       <subsection name="Create the Options">
         <p>
           An <a href="apidocs/org/apache/commons/cli/Options.html">
-          Options</a> object must be created and the<code>Option</code> must be 
+          Options</a> object must be created and the <code>Option</code> must be 
           added to it.
         </p>
         <source>
@@ -40,10 +40,10 @@
           <p>
             The <code>addOption</code> method has three parameters.  The first
             parameter is a <code>java.lang.String</code> that represents the option. 
-            Thesecond paramter is a <code>boolean</code> that specifies whether the
+            The second parameter is a <code>boolean</code> that specifies whether the
             option requires an argument or not.  In the case of a boolean option
             (sometimes referred to as a flag) an argument value is not present so
-            it <code>false</code> is passed.  The third parameter is the description
+            <code>false</code> is passed.  The third parameter is the description
             of the option.  This description will be used in the usage text of the
             application.
           </p>
@@ -51,7 +51,9 @@
       <subsection name="Parsing the command line arguments">
         <p>
           The <code>parse</code> methods of <code>CommandLineParser</code> are used 
-          to parse the command line arguments.  
+          to parse the command line arguments.  The <code>PosixPaser</code> is
+          great when you need to handle options that are one character long,
+          like the <code>t</code> option in this example.
         </p>
         <source>CommandLineParser parser = new PosixParser();
 CommandLine cmd = parser.parse( options, args);</source>
@@ -60,9 +62,9 @@
           this we will interrogate the 
           <a href="apidocs/org/apache/commons/cli/CommandLine.html">CommandLine
           </a> object.  The <code>hasOption</code> method takes a 
-          <code>java.lang.String</code> parameter and returns true if the option 
+          <code>java.lang.String</code> parameter and returns <code>true</code> if the option 
           represented by the <code>java.lang.String</code> is present, otherwise 
-          it returns false.
+          it returns <code>false</code>.
         </p>
         <source>if(cmd.hasOption("t")) {
     // print the date and time
@@ -81,7 +83,7 @@
         <source>// add c option
 options.addOption("c", true, "country code");</source>
         <p>
-          The second parameter is true this time.  This specifies that the
+          The second parameter is <code>true</code> this time.  This specifies that the
           <code>c</code> option requires an argument value.  If the required option
           argument value is specified on the command line it is returned,
           otherwise <code>null</code> is returned.
@@ -89,11 +91,11 @@
       </subsection>
       <subsection name="Retrieving the argument value">
         <p>
-          The <code>getOptionValue</code> methods of <code>Options</code> are
+          The <code>getOptionValue</code> methods of <code>CommandLine</code> are
           used to retrieve the argument values of options.
         </p>
         <source>// get c option value
-String countryCode = options.getOptionValue("c");
+String countryCode = cmd.getOptionValue("c");
 
 if(countryCode == null) {
     // print default date
@@ -106,9 +108,9 @@
 
     <section name="Ant Example">
       <p>
-        As one of the most ubquituous Java applications 
-        <a href="http://jakarta.apache.org/ant">Ant</a> it will be used
-        here to illustrate how to create the Options required.  The following
+        One of the most ubiquitous Java applications 
+        <a href="http://ant.apache.org/">Ant</a> will be used
+        here to illustrate how to create the <code>Options</code> required.  The following
         is the help output for Ant.
       </p>
       <source>ant [options] [target [target2 [target3] ...]]
@@ -130,8 +132,8 @@
       <subsection name="Boolean Options">
         <p>
           Lets create the boolean options for the application as they
-          are the easiest to create.  For clarity the constructors on
-          Option are used here.
+          are the easiest to create.  For clarity the constructors for
+          <code>Option</code> are used here.
         </p>
         <source>Option help = new Option( "help", "print this message" );
 Option projecthelp = new Option( "projecthelp", "print project help information" );
@@ -144,12 +146,12 @@
       </subsection>
       <subsection name="Argument Options">
         <p> 
-          The argument options are created using the OptionBuilder.
+          The argument options are created using the <code>OptionBuilder</code>.
         </p>
         <source>Option logfile   = OptionBuilder.withArgName( "file" )
                                 .hasArg()
                                 .withDescription(  "use given file for log" )
-                                .create( "file" );
+                                .create( "logfile" );
 
 Option logger    = OptionBuilder.withArgName( "classname" )
                                 .hasArg()
@@ -171,12 +173,12 @@
 Option find      = OptionBuilder.withArgName( "file" )
                                 .hasArg()
                                 .withDescription( "search for buildfile towards the "
-                                  + "root of the filesystem and use it" )
-                                .create( "file" );</source>
+                                                  + "root of the filesystem and use it" )
+                                .create( "find" );</source>
       </subsection>
       <subsection name="Java Property Option">
         <p>
-          The last option to create is the Java property and it too is created
+          The last option to create is the Java property and it is also created
           using the OptionBuilder.
         </p>
         <source>Option property  = OptionBuilder.withArgName( "property=value" )
@@ -192,7 +194,7 @@
           to create the 
           <a href="apidocs/org/apache/commons/cli/Options.html">Options</a> 
           instance.  This is achieved using the 
-          <a href="apidocs/org/apache/commons/cli/CommandLine.html#hasOption(java.lang.String)">addOption</a> 
+          <a href="apidocs/org/apache/commons/cli/CommandLine.html#addOption(org.apache.commons.cli.Option)">addOption</a> 
           method of <code>Options</code>.
         </p>
         <source>Options options = new Options();
@@ -217,13 +219,15 @@
       </subsection>
       <subsection name="Create the Parser">
         <p>
-          We now need to create a Parser.  This will parse the command
-          line arguments, using the rules specified by the Options and
+          We now need to create a <code>Parser</code>.  This will parse the command
+          line arguments, using the rules specified by the <code>Options</code> and
           return an instance of <a href="apidocs/org/apache/commons/cli/CommandLine.html">CommandLine</a>.
+          This time we will use a <a href="apidocs/org/apache/commons/cli/GnuParser.html">GnuParser</a>
+          which is able to handle options that are more than one character long.
         </p>
         <source>public static void main( String[] args ) {
     // create the parser
-    CommandLineParser parser = new PosixParser();
+    CommandLineParser parser = new GnuParser();
     try {
         // parse the command line arguments
         CommandLine line = parser.parse( options, args );
@@ -236,7 +240,7 @@
       </subsection>
       <subsection name="Querying the commandline">
         <p>
-          To see if an option has been passed the<code>hasOption</code>
+          To see if an option has been passed the <code>hasOption</code>
           method is used.  The argument value can be retrieved using
           the <code>getValue</code> method.
         </p>
@@ -285,8 +289,7 @@
       <p>
         One of the most widely used command line applications in the *nix world
         is <code>ls</code>.  To parse a command line for an application like this
-        a different parser is required, the
-        <a href="apidocs/org/apache/commons/cli/PosixParser.html">PosixParser</a>.
+        we will use the <a href="apidocs/org/apache/commons/cli/PosixParser.html">PosixParser</a>.
         Due to the large number of options required for <code>ls</code> this
         example will only cover a small proportion of the options.  The following
         is a section of the help output.

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/usage.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/versions_and_branches.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/cli/branches/CLI_1_BRANCH/xdocs/versions_and_branches.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message