public class HelpFormatter extends Object
Modifier and Type | Field and Description |
---|---|
static Set |
DEFAULT_DISPLAY_USAGE_SETTINGS
The default DisplaySettings used to select the help lines in the main
body of help
|
static Set |
DEFAULT_FULL_USAGE_SETTINGS
The default DisplaySettings used to select the elements to display in the
displayed line of full usage information.
|
static int |
DEFAULT_FULL_WIDTH
The default screen width
|
static String |
DEFAULT_GUTTER_CENTER
The default screen furniture right of screen
|
static String |
DEFAULT_GUTTER_LEFT
The default screen furniture left of screen
|
static String |
DEFAULT_GUTTER_RIGHT
The default screen furniture between columns
|
static Set |
DEFAULT_LINE_USAGE_SETTINGS
The default DisplaySettings used to select the elements of usage per help
line in the main body of help
|
Constructor and Description |
---|
HelpFormatter()
Creates a new HelpFormatter using the defaults
|
HelpFormatter(String gutterLeft,
String gutterCenter,
String gutterRight,
int fullWidth)
Creates a new HelpFormatter using the specified parameters
|
Modifier and Type | Method and Description |
---|---|
Comparator |
getComparator() |
Set |
getDisplaySettings() |
String |
getDivider() |
OptionException |
getException() |
String |
getFooter() |
Set |
getFullUsageSettings() |
Group |
getGroup() |
String |
getGutterCenter() |
String |
getGutterLeft() |
String |
getGutterRight() |
String |
getHeader() |
Set |
getLineUsageSettings() |
int |
getPageWidth() |
PrintWriter |
getPrintWriter() |
String |
getShellCommand() |
protected static void |
pad(String text,
int width,
PrintWriter writer) |
void |
print()
Prints the Option help.
|
void |
printDivider()
Prints the divider text
|
void |
printException()
Prints any error message.
|
void |
printFooter()
Prints a footer string if necessary
|
void |
printGutterLeft()
Prints the left gutter string
|
void |
printGutterRight()
Prints the right gutter string
|
void |
printHeader()
Prints a header string if necessary
|
void |
printHelp()
Prints detailed help per option.
|
void |
printUsage()
Prints a single line of usage information (wrapping if necessary)
|
void |
printWrapped(String text)
Prints a string wrapped if necessary
|
void |
setComparator(Comparator comparator)
The Comparator to use when sorting Options
|
void |
setDisplaySettings(Set displaySettings)
The DisplaySettings used to select the help lines in the main body of
help
|
void |
setDivider(String divider)
Sets the string to use as a divider between sections of help
|
void |
setException(OptionException exception)
Sets the exception to document
|
void |
setFooter(String footer)
Sets the footer text of the help screen
|
void |
setFullUsageSettings(Set fullUsageSettings)
The DisplaySettings used to select the elements to display in the
displayed line of full usage information.
|
void |
setGroup(Group group)
Sets the Group of Options to document
|
void |
setHeader(String header)
Sets the footer text of the help screen
|
void |
setLineUsageSettings(Set lineUsageSettings)
Sets the DisplaySettings used to select elements in the per helpline
usage strings.
|
void |
setPrintWriter(PrintWriter out) |
void |
setShellCommand(String shellCommand)
Sets the command string used to invoke the application
|
protected static List |
wrap(String text,
int width) |
public static final int DEFAULT_FULL_WIDTH
public static final String DEFAULT_GUTTER_LEFT
public static final String DEFAULT_GUTTER_CENTER
public static final String DEFAULT_GUTTER_RIGHT
public static final Set DEFAULT_FULL_USAGE_SETTINGS
DisplaySetting
public static final Set DEFAULT_LINE_USAGE_SETTINGS
DisplaySetting
public static final Set DEFAULT_DISPLAY_USAGE_SETTINGS
public HelpFormatter()
public HelpFormatter(String gutterLeft, String gutterCenter, String gutterRight, int fullWidth)
gutterLeft
- the string marking left of screengutterCenter
- the string marking center of screengutterRight
- the string marking right of screenfullWidth
- the width of the screenpublic void print()
public void printException()
public void printHelp()
public void printUsage()
public void printHeader()
public void printFooter()
public void printWrapped(String text)
text
- the string to wrappublic void printGutterLeft()
public void printGutterRight()
public void printDivider()
protected static void pad(String text, int width, PrintWriter writer)
public void setComparator(Comparator comparator)
comparator
- Comparator to use when sorting Optionspublic void setDisplaySettings(Set displaySettings)
displaySettings
- the settings to useDisplaySetting
public void setDivider(String divider)
divider
- the dividing stringpublic void setException(OptionException exception)
exception
- the exception that occuredpublic void setFooter(String footer)
footer
- the footer textpublic void setFullUsageSettings(Set fullUsageSettings)
fullUsageSettings
- DisplaySetting
public void setGroup(Group group)
group
- the options to documentpublic void setHeader(String header)
header
- the footer textpublic void setLineUsageSettings(Set lineUsageSettings)
lineUsageSettings
- the DisplaySettings to useDisplaySetting
public void setShellCommand(String shellCommand)
shellCommand
- the invokation commandpublic Comparator getComparator()
public Set getDisplaySettings()
public String getDivider()
public OptionException getException()
public Set getFullUsageSettings()
public String getGutterCenter()
public String getGutterLeft()
public String getGutterRight()
public Set getLineUsageSettings()
public int getPageWidth()
public String getShellCommand()
public void setPrintWriter(PrintWriter out)
out
- the PrintWriter to write topublic PrintWriter getPrintWriter()
Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.