commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1442985 - in /commons/proper/cli/trunk: pom.xml src/changes/changes.xml src/main/java/org/apache/commons/cli/Option.java src/main/java/org/apache/commons/cli/Options.java
Date Wed, 06 Feb 2013 14:27:49 GMT
Author: tn
Date: Wed Feb  6 14:27:48 2013
New Revision: 1442985

URL: http://svn.apache.org/viewvc?rev=1442985&view=rev
Log:
[CLI-214] Added method Options.addOption(String, String), thanks to Alexandru Mocanu for the
patch.

Modified:
    commons/proper/cli/trunk/pom.xml
    commons/proper/cli/trunk/src/changes/changes.xml
    commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java
    commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Options.java

Modified: commons/proper/cli/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/pom.xml?rev=1442985&r1=1442984&r2=1442985&view=diff
==============================================================================
--- commons/proper/cli/trunk/pom.xml (original)
+++ commons/proper/cli/trunk/pom.xml Wed Feb  6 14:27:48 2013
@@ -127,6 +127,9 @@
         <role>unit tests</role>
       </roles>
     </contributor>
+    <contributor>
+      <name>Alexandru Mocanu</name>
+    </contributor>
     
   </contributors>
 

Modified: commons/proper/cli/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/changes/changes.xml?rev=1442985&r1=1442984&r2=1442985&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/changes/changes.xml (original)
+++ commons/proper/cli/trunk/src/changes/changes.xml Wed Feb  6 14:27:48 2013
@@ -23,6 +23,9 @@
   <body>
     
     <release version="1.3" date="in SVN">
+      <action type="add" dev="tn" issue="CLI-214" due-to="Alexandru Mocanu">
+        Added new method Options.addOption(String, String).
+      </action>
       <action type="fix" dev="tn" issue="CLI-227" due-to="Duncan Jones">
         Changed unit tests to junit 4 annotation style.
       </action>

Modified: commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java?rev=1442985&r1=1442984&r2=1442985&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java (original)
+++ commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Option.java Wed Feb  6 14:27:48
2013
@@ -79,6 +79,7 @@ public class Option implements Cloneable
 
     /**
      * Creates an Option using the specified parameters.
+     * The option does not take an argument.
      *
      * @param opt short representation of the option
      * @param description describes the function of the option

Modified: commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Options.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Options.java?rev=1442985&r1=1442984&r2=1442985&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Options.java (original)
+++ commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Options.java Wed Feb  6
14:27:48 2013
@@ -100,6 +100,21 @@ public class Options implements Serializ
     }
 
     /**
+     * Add an option that only contains a short name.
+     * The option does not take an argument.
+     *
+     * @param opt Short single-character name of the option.
+     * @param description Self-documenting description
+     * @return the resulting Options instance
+     * @since 1.3
+     */
+    public Options addOption(String opt, String description)
+    {
+        addOption(opt, null, false, description);
+        return this;
+    }
+
+    /**
      * Add an option that only contains a short-name.
      * It may be specified as requiring an argument.
      *
@@ -111,7 +126,6 @@ public class Options implements Serializ
     public Options addOption(String opt, boolean hasArg, String description)
     {
         addOption(opt, null, hasArg, description);
-
         return this;
     }
 
@@ -128,7 +142,6 @@ public class Options implements Serializ
     public Options addOption(String opt, String longOpt, boolean hasArg, String description)
     {
         addOption(new Option(opt, longOpt, hasArg, description));
-
         return this;
     }
 



Mime
View raw message