org.apache.geronimo.cli
Class PrintHelper

java.lang.Object
  extended by org.apache.geronimo.cli.PrintHelper

public class PrintHelper
extends Object

This code is borrowed from commons-cli org.apache.commons.cli.HelpFormatter class. Its authors are Slawek Zachcial and John Keyes (john at integralsource.com). This class has been slightly updated to meet specific requirements.


Field Summary
static String DEFAULT_ARG_NAME
           
static int DEFAULT_DESC_PAD
           
static int DEFAULT_LEFT_PAD
           
static String DEFAULT_LONG_OPT_PREFIX
           
static String DEFAULT_OPT_PREFIX
           
static String DEFAULT_SYNTAX_PREFIX
           
static int DEFAULT_WIDTH
           
 String defaultArgName
           
 int defaultDescPad
           
 int defaultLeftPad
           
 String defaultLongOptPrefix
           
 String defaultNewLine
           
 String defaultOptPrefix
           
 String defaultSyntaxPrefix
           
 int defaultWidth
           
 
Constructor Summary
PrintHelper(OutputStream outputStream)
           
 
Method Summary
protected  String createPadding(int len)
           
protected  int findWrapPos(String text, int width, int startPos)
           
 void printHelp(int width, String cmdLineSyntax, String header, org.apache.commons.cli.Options options, String footer, boolean autoUsage)
           
 void printHelp(PrintWriter pw, int width, String cmdLineSyntax, String header, org.apache.commons.cli.Options options, int leftPad, int descPad, String footer, boolean autoUsage)
           
 void printHelp(String cmdLineSyntax, String header, org.apache.commons.cli.Options options, String footer, boolean autoUsage)
           
 void printOptions(PrintWriter pw, int width, org.apache.commons.cli.Options options, int leftPad, int descPad)
           
 void printOptions(PrintWriter pw, org.apache.commons.cli.Options options)
           
 void printOptionsNoDesc(PrintWriter pw, org.apache.commons.cli.Options options)
           
 void printUsage(PrintWriter pw, int width, String cmdLineSyntax)
           
 void printUsage(PrintWriter pw, int width, String app, org.apache.commons.cli.Options options)
           
 void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text)
           
 void printWrapped(PrintWriter pw, int width, String text)
           
static String reformat(String source, int indent, int endCol)
           
protected  StringBuffer renderOptions(StringBuffer sb, int width, org.apache.commons.cli.Options options, int leftPad, int descPad, boolean displayDesc)
           
protected  StringBuffer renderWrappedText(StringBuffer sb, int width, int nextLineTabStop, String text)
           
protected  String rtrim(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
See Also:
Constant Field Values

DEFAULT_LEFT_PAD

public static final int DEFAULT_LEFT_PAD
See Also:
Constant Field Values

DEFAULT_DESC_PAD

public static final int DEFAULT_DESC_PAD
See Also:
Constant Field Values

DEFAULT_SYNTAX_PREFIX

public static final String DEFAULT_SYNTAX_PREFIX
See Also:
Constant Field Values

DEFAULT_OPT_PREFIX

public static final String DEFAULT_OPT_PREFIX
See Also:
Constant Field Values

DEFAULT_LONG_OPT_PREFIX

public static final String DEFAULT_LONG_OPT_PREFIX
See Also:
Constant Field Values

DEFAULT_ARG_NAME

public static final String DEFAULT_ARG_NAME
See Also:
Constant Field Values

defaultWidth

public int defaultWidth

defaultLeftPad

public int defaultLeftPad

defaultDescPad

public int defaultDescPad

defaultSyntaxPrefix

public String defaultSyntaxPrefix

defaultNewLine

public String defaultNewLine

defaultOptPrefix

public String defaultOptPrefix

defaultLongOptPrefix

public String defaultLongOptPrefix

defaultArgName

public String defaultArgName
Constructor Detail

PrintHelper

public PrintHelper(OutputStream outputStream)
Method Detail

reformat

public static String reformat(String source,
                              int indent,
                              int endCol)

printHelp

public void printHelp(String cmdLineSyntax,
                      String header,
                      org.apache.commons.cli.Options options,
                      String footer,
                      boolean autoUsage)

printHelp

public void printHelp(int width,
                      String cmdLineSyntax,
                      String header,
                      org.apache.commons.cli.Options options,
                      String footer,
                      boolean autoUsage)

printHelp

public void printHelp(PrintWriter pw,
                      int width,
                      String cmdLineSyntax,
                      String header,
                      org.apache.commons.cli.Options options,
                      int leftPad,
                      int descPad,
                      String footer,
                      boolean autoUsage)
               throws IllegalArgumentException
Throws:
IllegalArgumentException

printUsage

public void printUsage(PrintWriter pw,
                       int width,
                       String app,
                       org.apache.commons.cli.Options options)

printUsage

public void printUsage(PrintWriter pw,
                       int width,
                       String cmdLineSyntax)

printOptions

public void printOptions(PrintWriter pw,
                         int width,
                         org.apache.commons.cli.Options options,
                         int leftPad,
                         int descPad)

printOptions

public void printOptions(PrintWriter pw,
                         org.apache.commons.cli.Options options)

printOptionsNoDesc

public void printOptionsNoDesc(PrintWriter pw,
                               org.apache.commons.cli.Options options)

printWrapped

public void printWrapped(PrintWriter pw,
                         int width,
                         String text)

printWrapped

public void printWrapped(PrintWriter pw,
                         int width,
                         int nextLineTabStop,
                         String text)

renderOptions

protected StringBuffer renderOptions(StringBuffer sb,
                                     int width,
                                     org.apache.commons.cli.Options options,
                                     int leftPad,
                                     int descPad,
                                     boolean displayDesc)

renderWrappedText

protected StringBuffer renderWrappedText(StringBuffer sb,
                                         int width,
                                         int nextLineTabStop,
                                         String text)

findWrapPos

protected int findWrapPos(String text,
                          int width,
                          int startPos)

createPadding

protected String createPadding(int len)

rtrim

protected String rtrim(String s)


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.