You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jk...@apache.org on 2002/07/10 23:08:32 UTC
cvs commit: jakarta-commons/cli/src/java/org/apache/commons/cli HelpFormatter.java
jkeyes 2002/07/10 14:08:32
Modified: cli/src/java/org/apache/commons/cli HelpFormatter.java
Log:
now supports new Option i.e. key changed from char to String
Revision Changes Path
1.4 +11 -3 jakarta-commons/cli/src/java/org/apache/commons/cli/HelpFormatter.java
Index: HelpFormatter.java
===================================================================
RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/HelpFormatter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HelpFormatter.java 9 Jul 2002 23:12:15 -0000 1.3
+++ HelpFormatter.java 10 Jul 2002 21:08:32 -0000 1.4
@@ -72,6 +72,7 @@
* A formatter of help messages for the current command line options
*
* @author Slawek Zachcial
+ * @author John Keyes (jbjk at mac.com)
**/
public class HelpFormatter
{
@@ -244,14 +245,21 @@
//finally render options
int nextLineTabStop = max + descPad;
- char opt;
+ String opt;
int optOffset = leftPad + defaultOptPrefix.length();
for ( Iterator i = prefixList.iterator(); i.hasNext(); )
{
optBuf = (StringBuffer) i.next();
- opt = optBuf.charAt(optOffset);
- option = options.getOption( "" + opt);
+ opt = optBuf.toString();
+ if( opt.indexOf( ',' ) != -1 ) {
+ opt = opt.substring( optOffset, opt.indexOf( ',', optOffset ) );
+ }
+ else {
+ opt = opt.substring( optOffset, opt.indexOf( ' ', optOffset ) );
+ }
+ option = options.getOption( "-" + opt );
+
renderWrappedText(sb, width, nextLineTabStop,
optBuf.append(option.getDescription()).toString());
if ( i.hasNext() )
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>