| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.cli.HelpFormatter
A formatter of help messages for the current command line options
| Field Summary | |
| static String | DEFAULT_ARG_NAMEdefault name for an argument | 
| static int | DEFAULT_DESC_PADthe number of characters of padding to be prefixed to each description line | 
| static int | DEFAULT_LEFT_PADdefault padding to the left of each line | 
| static String | DEFAULT_LONG_OPT_PREFIXdefault prefix for long Option | 
| static String | DEFAULT_OPT_PREFIXdefault prefix for shortOpts | 
| static String | DEFAULT_SYNTAX_PREFIXthe string to display at the begining of the usage statement | 
| static int | DEFAULT_WIDTHdefault number of characters per line | 
|  String | defaultArgNameDeprecated. Scope will be made private for next major version - use get/setArgName methods instead. | 
|  int | defaultDescPadDeprecated. Scope will be made private for next major version - use get/setDescPadding methods instead. | 
|  int | defaultLeftPadDeprecated. Scope will be made private for next major version - use get/setLeftPadding methods instead. | 
|  String | defaultLongOptPrefixDeprecated. Scope will be made private for next major version - use get/setLongOptPrefix methods instead. | 
|  String | defaultNewLineDeprecated. Scope will be made private for next major version - use get/setNewLine methods instead. | 
|  String | defaultOptPrefixDeprecated. Scope will be made private for next major version - use get/setOptPrefix methods instead. | 
|  String | defaultSyntaxPrefixDeprecated. Scope will be made private for next major version - use get/setSyntaxPrefix methods instead. | 
|  int | defaultWidthDeprecated. Scope will be made private for next major version - use get/setWidth methods instead. | 
| Constructor Summary | |
| HelpFormatter() | |
| Method Summary | |
| protected  String | createPadding(int len)Return a String of padding of length len. | 
| protected  int | findWrapPos(String text,
            int width,
            int startPos)Finds the next text wrap position after startPosfor the 
 text intextwith the column widthwidth. | 
|  String | getArgName()Returns the 'argName'. | 
|  int | getDescPadding()Returns the 'descPadding'. | 
|  int | getLeftPadding()Returns the 'leftPadding'. | 
|  String | getLongOptPrefix()Returns the 'longOptPrefix'. | 
|  String | getNewLine()Returns the 'newLine'. | 
|  String | getOptPrefix()Returns the 'optPrefix'. | 
|  String | getSyntaxPrefix()Returns the 'syntaxPrefix'. | 
|  int | getWidth()Returns the 'width'. | 
|  void | printHelp(int width,
          String cmdLineSyntax,
          String header,
          Options options,
          String footer)Print the help for optionswith the specified
 command line syntax. | 
|  void | printHelp(int width,
          String cmdLineSyntax,
          String header,
          Options options,
          String footer,
          boolean autoUsage)Print the help for optionswith the specified
 command line syntax. | 
|  void | printHelp(PrintWriter pw,
          int width,
          String cmdLineSyntax,
          String header,
          Options options,
          int leftPad,
          int descPad,
          String footer)Print the help for optionswith the specified
 command line syntax. | 
|  void | printHelp(PrintWriter pw,
          int width,
          String cmdLineSyntax,
          String header,
          Options options,
          int leftPad,
          int descPad,
          String footer,
          boolean autoUsage)Print the help for optionswith the specified
 command line syntax. | 
|  void | printHelp(String cmdLineSyntax,
          Options options)Print the help for optionswith the specified
 command line syntax. | 
|  void | printHelp(String cmdLineSyntax,
          Options options,
          boolean autoUsage)Print the help for optionswith the specified
 command line syntax. | 
|  void | printHelp(String cmdLineSyntax,
          String header,
          Options options,
          String footer)Print the help for optionswith the specified
 command line syntax. | 
|  void | printHelp(String cmdLineSyntax,
          String header,
          Options options,
          String footer,
          boolean autoUsage)Print the help for optionswith the specified
 command line syntax. | 
|  void | printOptions(PrintWriter pw,
             int width,
             Options options,
             int leftPad,
             int descPad)Print the help for the specified Options to the specified writer, using the specified width, left padding and description padding. | 
|  void | printUsage(PrintWriter pw,
           int width,
           String cmdLineSyntax)Print the cmdLineSyntax to the specified writer, using the specified width. | 
|  void | printUsage(PrintWriter pw,
           int width,
           String app,
           Options options)Prints the usage statement for the specified application. | 
|  void | printWrapped(PrintWriter pw,
             int width,
             int nextLineTabStop,
             String text)Print the specified text to the specified PrintWriter. | 
|  void | printWrapped(PrintWriter pw,
             int width,
             String text)Print the specified text to the specified PrintWriter. | 
| protected  StringBuffer | renderOptions(StringBuffer sb,
              int width,
              Options options,
              int leftPad,
              int descPad)Render the specified Options and return the rendered Options in a StringBuffer. | 
| protected  StringBuffer | renderWrappedText(StringBuffer sb,
                  int width,
                  int nextLineTabStop,
                  String text)Render the specified text and return the rendered Options in a StringBuffer. | 
| protected  String | rtrim(String s)Remove the trailing whitespace from the specified String. | 
|  void | setArgName(String name)Sets the 'argName'. | 
|  void | setDescPadding(int padding)Sets the 'descPadding'. | 
|  void | setLeftPadding(int padding)Sets the 'leftPadding'. | 
|  void | setLongOptPrefix(String prefix)Sets the 'longOptPrefix'. | 
|  void | setNewLine(String newline)Sets the 'newLine'. | 
|  void | setOptPrefix(String prefix)Sets the 'optPrefix'. | 
|  void | setSyntaxPrefix(String prefix)Sets the 'syntaxPrefix'. | 
|  void | setWidth(int width)Sets the 'width'. | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
public static final int DEFAULT_WIDTH
public static final int DEFAULT_LEFT_PAD
public static final int DEFAULT_DESC_PAD
public static final String DEFAULT_SYNTAX_PREFIX
public static final String DEFAULT_OPT_PREFIX
public static final String DEFAULT_LONG_OPT_PREFIX
public static final String DEFAULT_ARG_NAME
public int defaultWidth
public int defaultLeftPad
public int defaultDescPad
public String defaultSyntaxPrefix
public String defaultNewLine
public String defaultOptPrefix
public String defaultLongOptPrefix
public String defaultArgName
| Constructor Detail | 
public HelpFormatter()
| Method Detail | 
public void setWidth(int width)
width - the new value of 'width'public int getWidth()
public void setLeftPadding(int padding)
padding - the new value of 'leftPadding'public int getLeftPadding()
public void setDescPadding(int padding)
padding - the new value of 'descPadding'public int getDescPadding()
public void setSyntaxPrefix(String prefix)
prefix - the new value of 'syntaxPrefix'public String getSyntaxPrefix()
public void setNewLine(String newline)
newline - the new value of 'newLine'public String getNewLine()
public void setOptPrefix(String prefix)
prefix - the new value of 'optPrefix'public String getOptPrefix()
public void setLongOptPrefix(String prefix)
prefix - the new value of 'longOptPrefix'public String getLongOptPrefix()
public void setArgName(String name)
name - the new value of 'argName'public String getArgName()
public void printHelp(String cmdLineSyntax,
                      Options options)
Print the help for options with the specified
 command line syntax.  This method prints help information to
 System.out.
cmdLineSyntax - the syntax for this applicationoptions - the Options instance
public void printHelp(String cmdLineSyntax,
                      Options options,
                      boolean autoUsage)
Print the help for options with the specified
 command line syntax.  This method prints help information to 
 System.out.
cmdLineSyntax - the syntax for this applicationoptions - the Options instanceautoUsage - whether to print an automatically generated 
 usage statement
public void printHelp(String cmdLineSyntax,
                      String header,
                      Options options,
                      String footer)
Print the help for options with the specified
 command line syntax.  This method prints help information to
 System.out.
cmdLineSyntax - the syntax for this applicationheader - the banner to display at the begining of the helpoptions - the Options instancefooter - the banner to display at the end of the help
public void printHelp(String cmdLineSyntax,
                      String header,
                      Options options,
                      String footer,
                      boolean autoUsage)
Print the help for options with the specified
 command line syntax.  This method prints help information to 
 System.out.
cmdLineSyntax - the syntax for this applicationheader - the banner to display at the begining of the helpoptions - the Options instancefooter - the banner to display at the end of the helpautoUsage - whether to print an automatically generated 
 usage statement
public void printHelp(int width,
                      String cmdLineSyntax,
                      String header,
                      Options options,
                      String footer)
Print the help for options with the specified
 command line syntax.  This method prints help information to
 System.out.
width - the number of characters to be displayed on each linecmdLineSyntax - the syntax for this applicationheader - the banner to display at the begining of the helpoptions - the Options instancefooter - the banner to display at the end of the help
public void printHelp(int width,
                      String cmdLineSyntax,
                      String header,
                      Options options,
                      String footer,
                      boolean autoUsage)
Print the help for options with the specified
 command line syntax.  This method prints help information to
 System.out.
width - the number of characters to be displayed on each linecmdLineSyntax - the syntax for this applicationheader - the banner to display at the begining of the helpoptions - the Options instancefooter - the banner to display at the end of the helpautoUsage - whether to print an automatically generated 
 usage statement
public void printHelp(PrintWriter pw,
                      int width,
                      String cmdLineSyntax,
                      String header,
                      Options options,
                      int leftPad,
                      int descPad,
                      String footer)
Print the help for options with the specified
 command line syntax.
pw - the writer to which the help will be writtenwidth - the number of characters to be displayed on each linecmdLineSyntax - the syntax for this applicationheader - the banner to display at the begining of the helpoptions - the Options instanceleftPad - the number of characters of padding to be prefixed
 to each linedescPad - the number of characters of padding to be prefixed
 to each description linefooter - the banner to display at the end of the help
public void printHelp(PrintWriter pw,
                      int width,
                      String cmdLineSyntax,
                      String header,
                      Options options,
                      int leftPad,
                      int descPad,
                      String footer,
                      boolean autoUsage)
Print the help for options with the specified
 command line syntax.
pw - the writer to which the help will be writtenwidth - the number of characters to be displayed on each linecmdLineSyntax - the syntax for this applicationheader - the banner to display at the begining of the helpoptions - the Options instanceleftPad - the number of characters of padding to be prefixed
 to each linedescPad - the number of characters of padding to be prefixed
 to each description linefooter - the banner to display at the end of the helpautoUsage - whether to print an automatically generated 
 usage statement
public void printUsage(PrintWriter pw,
                       int width,
                       String app,
                       Options options)
Prints the usage statement for the specified application.
pw - The PrintWriter to print the usage statementwidth - The number of characters to display per lineapp - The application nameoptions - The command line Options
public void printUsage(PrintWriter pw,
                       int width,
                       String cmdLineSyntax)
Print the cmdLineSyntax to the specified writer, using the specified width.
pw - The printWriter to write the help towidth - The number of characters per line for the usage statement.cmdLineSyntax - The usage statement.
public void printOptions(PrintWriter pw,
                         int width,
                         Options options,
                         int leftPad,
                         int descPad)
Print the help for the specified Options to the specified writer, using the specified width, left padding and description padding.
pw - The printWriter to write the help towidth - The number of characters to display per lineoptions - The command line OptionsleftPad - the number of characters of padding to be prefixed
 to each linedescPad - the number of characters of padding to be prefixed
 to each description line
public void printWrapped(PrintWriter pw,
                         int width,
                         String text)
Print the specified text to the specified PrintWriter.
pw - The printWriter to write the help towidth - The number of characters to display per linetext - The text to be written to the PrintWriter
public void printWrapped(PrintWriter pw,
                         int width,
                         int nextLineTabStop,
                         String text)
Print the specified text to the specified PrintWriter.
pw - The printWriter to write the help towidth - The number of characters to display per linenextLineTabStop - The position on the next line for the first tab.text - The text to be written to the PrintWriter
protected StringBuffer renderOptions(StringBuffer sb,
                                     int width,
                                     Options options,
                                     int leftPad,
                                     int descPad)
Render the specified Options and return the rendered Options in a StringBuffer.
sb - The StringBuffer to place the rendered Options into.width - The number of characters to display per lineoptions - The command line OptionsleftPad - the number of characters of padding to be prefixed
 to each linedescPad - the number of characters of padding to be prefixed
 to each description line
protected StringBuffer renderWrappedText(StringBuffer sb,
                                         int width,
                                         int nextLineTabStop,
                                         String text)
Render the specified text and return the rendered Options in a StringBuffer.
sb - The StringBuffer to place the rendered text into.width - The number of characters to display per linenextLineTabStop - The position on the next line for the first tab.text - The text to be rendered.
protected int findWrapPos(String text,
                          int width,
                          int startPos)
startPos for the 
 text in text with the column width width.
 The wrap point is the last postion before startPos+width having a 
 whitespace character (space, \n, \r).
text - The text being searched for the wrap positionwidth - width of the wrapped textstartPos - position from which to start the lookup whitespace 
 character
protected String createPadding(int len)
Return a String of padding of length len.
len - The length of the String of padding to create.
protected String rtrim(String s)
Remove the trailing whitespace from the specified String.
s - The String to remove the trailing padding from.
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||