commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r539899 - /jakarta/commons/proper/cli/branches/avalon-implementation/src/java/org/apache/commons/cli/avalon/CLUtil.java
Date Sun, 20 May 2007 18:10:19 GMT
Author: sebb
Date: Sun May 20 11:10:17 2007
New Revision: 539899

URL: http://svn.apache.org/viewvc?view=rev&rev=539899
Log:
Add optional argument to help output

Modified:
    jakarta/commons/proper/cli/branches/avalon-implementation/src/java/org/apache/commons/cli/avalon/CLUtil.java

Modified: jakarta/commons/proper/cli/branches/avalon-implementation/src/java/org/apache/commons/cli/avalon/CLUtil.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/cli/branches/avalon-implementation/src/java/org/apache/commons/cli/avalon/CLUtil.java?view=diff&rev=539899&r1=539898&r2=539899
==============================================================================
--- jakarta/commons/proper/cli/branches/avalon-implementation/src/java/org/apache/commons/cli/avalon/CLUtil.java
(original)
+++ jakarta/commons/proper/cli/branches/avalon-implementation/src/java/org/apache/commons/cli/avalon/CLUtil.java
Sun May 20 11:10:17 2007
@@ -46,12 +46,15 @@
             final String name = options[i].getName();
             String description = options[i].getDescription();
             int flags = options[i].getFlags();
+            boolean argumentOptional = 
+                    ((flags & CLOptionDescriptor.ARGUMENT_OPTIONAL) == 
+                              CLOptionDescriptor.ARGUMENT_OPTIONAL);
             boolean argumentRequired =
                     ((flags & CLOptionDescriptor.ARGUMENT_REQUIRED) ==
-                    CLOptionDescriptor.ARGUMENT_REQUIRED);
+                              CLOptionDescriptor.ARGUMENT_REQUIRED);
             boolean twoArgumentsRequired =
                     ((flags & CLOptionDescriptor.ARGUMENTS_REQUIRED_2) ==
-                    CLOptionDescriptor.ARGUMENTS_REQUIRED_2);
+                              CLOptionDescriptor.ARGUMENTS_REQUIRED_2);
             boolean needComma = false;
             if( twoArgumentsRequired )
             {
@@ -78,6 +81,10 @@
                 sb.append( name );
             }
 
+            if (argumentOptional)
+            {
+                sb.append(" [[=]<argument>]");
+            }
             if( argumentRequired )
             {
                 sb.append( " <argument>" );



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