org.apache.commons.cli
public class HelpFormatter extends Object
Nested Class Summary | |
---|---|
static class | HelpFormatter.StringBufferComparator |
Field Summary | |
---|---|
String | defaultArgName |
int | defaultDescPad |
int | defaultLeftPad |
String | defaultLongOptPrefix |
String | defaultNewLine |
String | defaultOptPrefix |
String | defaultSyntaxPrefix |
int | defaultWidth |
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 |
Constructor Summary | |
---|---|
HelpFormatter() |
Method Summary | |
---|---|
protected String | createPadding(int len) |
protected int | findWrapPos(String text, int width, int startPos)
Finds the next text wrap position after startPos for the text
in sb with the column width width .
|
void | printHelp(String cmdLineSyntax, Options options) |
void | printHelp(String cmdLineSyntax, Options options, boolean autoUsage) |
void | printHelp(String cmdLineSyntax, String header, Options options, String footer) |
void | printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage) |
void | printHelp(int width, String cmdLineSyntax, String header, Options options, String footer) |
void | printHelp(int width, String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage) |
void | printHelp(PrintWriter pw, int width, String cmdLineSyntax, String header, Options options, int leftPad, int descPad, String footer) |
void | printHelp(PrintWriter pw, int width, String cmdLineSyntax, String header, Options options, int leftPad, int descPad, String footer, boolean autoUsage) |
void | printOptions(PrintWriter pw, int width, Options options, int leftPad, int descPad) |
void | printUsage(PrintWriter pw, int width, String app, Options options) Prints the usage statement for the specified application. |
void | printUsage(PrintWriter pw, int width, String cmdLineSyntax) |
void | printWrapped(PrintWriter pw, int width, String text) |
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) |
protected String | rtrim(String s) |
startPos
for the text
in sb
with the column width width
.
The wrap point is the last postion before startPos+width having a whitespace
character (space, \n, \r).
Parameters: sb text to be analyzed width width of the wrapped text startPos position from which to start the lookup whitespace character
Returns: postion on which the text must be wrapped or -1 if the wrap position is at the end of the text
Prints the usage statement for the specified application.
Parameters: pw The PrintWriter to print the usage statement width ?? appName The application name options The command line Options