| java.lang.Object org.apache.commons.cli.HelpFormatter
HelpFormatter | public class HelpFormatter (Code) | | A formatter of help messages for the current command line options
author: Slawek Zachcial author: John Keyes (john at integralsource.com) |
Method Summary | |
protected String | createPadding(int len) Return a String of padding of length len .
Parameters: len - The length of the String of padding to create. | protected int | findWrapPos(String text, int width, int startPos) Finds the next text wrap position after startPos for the
text in text with the column width width . | public String | getArgName() Returns the 'argName'. | public int | getDescPadding() Returns the 'descPadding'. | public int | getLeftPadding() Returns the 'leftPadding'. | public String | getLongOptPrefix() Returns the 'longOptPrefix'. | public String | getNewLine() Returns the 'newLine'. | public String | getOptPrefix() Returns the 'optPrefix'. | public String | getSyntaxPrefix() Returns the 'syntaxPrefix'. | public int | getWidth() Returns the 'width'. | public void | printHelp(String cmdLineSyntax, Options options) Print the help for options with the specified
command line syntax. | public void | printHelp(String cmdLineSyntax, Options options, boolean autoUsage) Print the help for options with the specified
command line syntax. | public void | printHelp(String cmdLineSyntax, String header, Options options, String footer) Print the help for options with the specified
command line syntax. | public void | printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage) Print the help for options with the specified
command line syntax. | public void | printHelp(int width, String cmdLineSyntax, String header, Options options, String footer) Print the help for options with the specified
command line syntax. | 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. | public void | printHelp(PrintWriter pw, int width, String cmdLineSyntax, String header, Options options, int leftPad, int descPad, String footer) | public void | printHelp(PrintWriter pw, int width, String cmdLineSyntax, String header, Options options, int leftPad, int descPad, String footer, boolean autoUsage) | public void | printOptions(PrintWriter pw, int width, Options options, int leftPad, int descPad) | public void | printUsage(PrintWriter pw, int width, String app, Options options) | public void | printUsage(PrintWriter pw, int width, String cmdLineSyntax) | public void | printWrapped(PrintWriter pw, int width, String text) | public void | printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text) | protected StringBuffer | renderOptions(StringBuffer sb, int width, Options options, int leftPad, int descPad) | protected StringBuffer | renderWrappedText(StringBuffer sb, int width, int nextLineTabStop, String text) Render the specified text and return the rendered Options
in a StringBuffer.
Parameters: sb - The StringBuffer to place the rendered text into. Parameters: width - The number of characters to display per line Parameters: nextLineTabStop - The position on the next line for the first tab. Parameters: text - The text to be rendered. | protected String | rtrim(String s) Remove the trailing whitespace from the specified String.
Parameters: s - The String to remove the trailing padding from. | public void | setArgName(String name) Sets the 'argName'. | public void | setDescPadding(int padding) Sets the 'descPadding'. | public void | setLeftPadding(int padding) Sets the 'leftPadding'. | public void | setLongOptPrefix(String prefix) Sets the 'longOptPrefix'. | public void | setNewLine(String newline) Sets the 'newLine'. | public void | setOptPrefix(String prefix) Sets the 'optPrefix'. | public void | setSyntaxPrefix(String prefix) Sets the 'syntaxPrefix'. | public void | setWidth(int width) Sets the 'width'. |
DEFAULT_ARG_NAME | final public static String DEFAULT_ARG_NAME(Code) | | default name for an argument
|
DEFAULT_DESC_PAD | final public static int DEFAULT_DESC_PAD(Code) | | the number of characters of padding to be prefixed
to each description line
|
DEFAULT_LEFT_PAD | final public static int DEFAULT_LEFT_PAD(Code) | | default padding to the left of each line
|
DEFAULT_LONG_OPT_PREFIX | final public static String DEFAULT_LONG_OPT_PREFIX(Code) | | default prefix for long Option
|
DEFAULT_OPT_PREFIX | final public static String DEFAULT_OPT_PREFIX(Code) | | default prefix for shortOpts
|
DEFAULT_SYNTAX_PREFIX | final public static String DEFAULT_SYNTAX_PREFIX(Code) | | the string to display at the begining of the usage statement
|
DEFAULT_WIDTH | final public static int DEFAULT_WIDTH(Code) | | default number of characters per line
|
defaultArgName | public String defaultArgName(Code) | | the name of the argument
|
defaultDescPad | public int defaultDescPad(Code) | | the number of characters of padding to be prefixed
to each description line
|
defaultLeftPad | public int defaultLeftPad(Code) | | amount of padding to the left of each line
|
defaultLongOptPrefix | public String defaultLongOptPrefix(Code) | | the long Opt prefix
|
defaultNewLine | public String defaultNewLine(Code) | | the new line string
|
defaultOptPrefix | public String defaultOptPrefix(Code) | | the shortOpt prefix
|
defaultSyntaxPrefix | public String defaultSyntaxPrefix(Code) | | the string to display at the begining of the usage statement
|
defaultWidth | public int defaultWidth(Code) | | number of characters per line
|
createPadding | protected String createPadding(int len)(Code) | | Return a String of padding of length len .
Parameters: len - The length of the String of padding to create. The String of padding |
findWrapPos | protected int findWrapPos(String text, int width, int startPos)(Code) | | Finds the next text wrap position after 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).
Parameters: text - The text being searched for the wrap position Parameters: width - width of the wrapped text Parameters: startPos - position from which to start the lookup whitespace character postion on which the text must be wrapped or -1 if the wrap position is at the end of the text |
getArgName | public String getArgName()(Code) | | Returns the 'argName'.
the 'argName' |
getDescPadding | public int getDescPadding()(Code) | | Returns the 'descPadding'.
the 'descPadding' |
getLeftPadding | public int getLeftPadding()(Code) | | Returns the 'leftPadding'.
the 'leftPadding' |
getLongOptPrefix | public String getLongOptPrefix()(Code) | | Returns the 'longOptPrefix'.
the 'longOptPrefix' |
getNewLine | public String getNewLine()(Code) | | Returns the 'newLine'.
the 'newLine' |
getOptPrefix | public String getOptPrefix()(Code) | | Returns the 'optPrefix'.
the 'optPrefix' |
getSyntaxPrefix | public String getSyntaxPrefix()(Code) | | Returns the 'syntaxPrefix'.
the 'syntaxPrefix' |
getWidth | public int getWidth()(Code) | | Returns the 'width'.
the 'width' |
printHelp | public void printHelp(String cmdLineSyntax, Options options)(Code) | | Print the help for options with the specified
command line syntax. This method prints help information to
System.out.
Parameters: cmdLineSyntax - the syntax for this application Parameters: options - the Options instance |
printHelp | public void printHelp(String cmdLineSyntax, Options options, boolean autoUsage)(Code) | | Print the help for options with the specified
command line syntax. This method prints help information to
System.out.
Parameters: cmdLineSyntax - the syntax for this application Parameters: options - the Options instance Parameters: autoUsage - whether to print an automatically generated usage statement |
printHelp | public void printHelp(String cmdLineSyntax, String header, Options options, String footer)(Code) | | Print the help for options with the specified
command line syntax. This method prints help information to
System.out.
Parameters: cmdLineSyntax - the syntax for this application Parameters: header - the banner to display at the begining of the help Parameters: options - the Options instance Parameters: footer - the banner to display at the end of the help |
printHelp | public void printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage)(Code) | | Print the help for options with the specified
command line syntax. This method prints help information to
System.out.
Parameters: cmdLineSyntax - the syntax for this application Parameters: header - the banner to display at the begining of the help Parameters: options - the Options instance Parameters: footer - the banner to display at the end of the help Parameters: autoUsage - whether to print an automatically generated usage statement |
printHelp | public void printHelp(int width, String cmdLineSyntax, String header, Options options, String footer)(Code) | | Print the help for options with the specified
command line syntax. This method prints help information to
System.out.
Parameters: width - the number of characters to be displayed on each line Parameters: cmdLineSyntax - the syntax for this application Parameters: header - the banner to display at the begining of the help Parameters: options - the Options instance Parameters: footer - the banner to display at the end of the help |
printHelp | public void printHelp(int width, String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage)(Code) | | Print the help for options with the specified
command line syntax. This method prints help information to
System.out.
Parameters: width - the number of characters to be displayed on each line Parameters: cmdLineSyntax - the syntax for this application Parameters: header - the banner to display at the begining of the help Parameters: options - the Options instance Parameters: footer - the banner to display at the end of the help Parameters: autoUsage - whether to print an automatically generated usage statement |
printHelp | public void printHelp(PrintWriter pw, int width, String cmdLineSyntax, String header, Options options, int leftPad, int descPad, String footer)(Code) | | Print the help for options with the specified
command line syntax.
Parameters: pw - the writer to which the help will be written Parameters: width - the number of characters to be displayed on each line Parameters: cmdLineSyntax - the syntax for this application Parameters: header - the banner to display at the begining of the help Parameters: options - the Options instance Parameters: leftPad - the number of characters of padding to be prefixedto each line Parameters: descPad - the number of characters of padding to be prefixedto each description line Parameters: footer - the banner to display at the end of the help |
printHelp | public void printHelp(PrintWriter pw, int width, String cmdLineSyntax, String header, Options options, int leftPad, int descPad, String footer, boolean autoUsage)(Code) | | Print the help for options with the specified
command line syntax.
Parameters: pw - the writer to which the help will be written Parameters: width - the number of characters to be displayed on each line Parameters: cmdLineSyntax - the syntax for this application Parameters: header - the banner to display at the begining of the help Parameters: options - the Options instance Parameters: leftPad - the number of characters of padding to be prefixedto each line Parameters: descPad - the number of characters of padding to be prefixedto each description line Parameters: footer - the banner to display at the end of the help Parameters: autoUsage - whether to print an automatically generated usage statement |
printOptions | public void printOptions(PrintWriter pw, int width, Options options, int leftPad, int descPad)(Code) | | Print the help for the specified Options to the specified writer,
using the specified width, left padding and description padding.
Parameters: pw - The printWriter to write the help to Parameters: width - The number of characters to display per line Parameters: options - The command line Options Parameters: leftPad - the number of characters of padding to be prefixedto each line Parameters: descPad - the number of characters of padding to be prefixedto each description line |
printUsage | public void printUsage(PrintWriter pw, int width, String app, Options options)(Code) | | Prints the usage statement for the specified application.
Parameters: pw - The PrintWriter to print the usage statement Parameters: width - The number of characters to display per line Parameters: app - The application name Parameters: options - The command line Options |
printUsage | public void printUsage(PrintWriter pw, int width, String cmdLineSyntax)(Code) | | Print the cmdLineSyntax to the specified writer, using the
specified width.
Parameters: pw - The printWriter to write the help to Parameters: width - The number of characters per line for the usage statement. Parameters: cmdLineSyntax - The usage statement. |
printWrapped | public void printWrapped(PrintWriter pw, int width, String text)(Code) | | Print the specified text to the specified PrintWriter.
Parameters: pw - The printWriter to write the help to Parameters: width - The number of characters to display per line Parameters: text - The text to be written to the PrintWriter |
printWrapped | public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text)(Code) | | Print the specified text to the specified PrintWriter.
Parameters: pw - The printWriter to write the help to Parameters: width - The number of characters to display per line Parameters: nextLineTabStop - The position on the next line for the first tab. Parameters: text - The text to be written to the PrintWriter |
renderOptions | protected StringBuffer renderOptions(StringBuffer sb, int width, Options options, int leftPad, int descPad)(Code) | | Render the specified Options and return the rendered Options
in a StringBuffer.
Parameters: sb - The StringBuffer to place the rendered Options into. Parameters: width - The number of characters to display per line Parameters: options - The command line Options Parameters: leftPad - the number of characters of padding to be prefixedto each line Parameters: descPad - the number of characters of padding to be prefixedto each description line the StringBuffer with the rendered Options contents. |
renderWrappedText | protected StringBuffer renderWrappedText(StringBuffer sb, int width, int nextLineTabStop, String text)(Code) | | Render the specified text and return the rendered Options
in a StringBuffer.
Parameters: sb - The StringBuffer to place the rendered text into. Parameters: width - The number of characters to display per line Parameters: nextLineTabStop - The position on the next line for the first tab. Parameters: text - The text to be rendered. the StringBuffer with the rendered Options contents. |
rtrim | protected String rtrim(String s)(Code) | | Remove the trailing whitespace from the specified String.
Parameters: s - The String to remove the trailing padding from. The String of without the trailing padding |
setArgName | public void setArgName(String name)(Code) | | Sets the 'argName'.
Parameters: name - the new value of 'argName' |
setDescPadding | public void setDescPadding(int padding)(Code) | | Sets the 'descPadding'.
Parameters: padding - the new value of 'descPadding' |
setLeftPadding | public void setLeftPadding(int padding)(Code) | | Sets the 'leftPadding'.
Parameters: padding - the new value of 'leftPadding' |
setLongOptPrefix | public void setLongOptPrefix(String prefix)(Code) | | Sets the 'longOptPrefix'.
Parameters: prefix - the new value of 'longOptPrefix' |
setNewLine | public void setNewLine(String newline)(Code) | | Sets the 'newLine'.
Parameters: newline - the new value of 'newLine' |
setOptPrefix | public void setOptPrefix(String prefix)(Code) | | Sets the 'optPrefix'.
Parameters: prefix - the new value of 'optPrefix' |
setSyntaxPrefix | public void setSyntaxPrefix(String prefix)(Code) | | Sets the 'syntaxPrefix'.
Parameters: prefix - the new value of 'syntaxPrefix' |
setWidth | public void setWidth(int width)(Code) | | Sets the 'width'.
Parameters: width - the new value of 'width' |
|
|