net.dpml.cli.util
public class HelpFormatter extends Object
Version: @PROJECT-VERSION@
Field Summary | |
---|---|
static int | DEFAULT_DESCRIPTION_WIDTH
The default minimum description width. |
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 Summary | |
---|---|
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 | |
HelpFormatter(String gutterLeft, String gutterCenter, String gutterRight, int fullWidth, int descriptionWidth)
Creates a new HelpFormatter using the specified parameters |
Method Summary | |
---|---|
Comparator | getComparator()
Return the comparator. |
Set | getDisplaySettings()
Return the display settings. |
String | getDivider()
Return the divider. |
OptionException | getException()
Return the option exception |
String | getFooter()
Return the footer text. |
Set | getFullUsageSettings()
Return the full usage display settings. |
Group | getGroup()
Return the group. |
String | getGutterCenter()
Return the gutter center string. |
String | getGutterLeft()
Return the gutter left string. |
String | getGutterRight()
Return the gutter right string. |
String | getHeader()
Return the header string. |
Set | getLineUsageSettings()
Return the line usage settings. |
int | getPageWidth()
Return the page width. |
PrintWriter | getPrintWriter()
Return the print writer. |
String | getShellCommand()
Return the shell command. |
protected static void | pad(String text, int width, Writer writer)
Pad the supplied string. |
void | print()
Prints the Option help. |
void | printDivider()
Prints the m_divider text |
void | printException()
Prints any error message. |
void | printFooter()
Prints a m_footer string if necessary |
void | printGutterLeft()
Prints the left gutter string |
void | printGutterRight()
Prints the right gutter string |
void | printHeader()
Prints a m_header string if necessary |
void | printHelp()
Prints detailed help per option. |
void | printUsage()
Prints a single line of usage information (wrapping if necessary) |
protected 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 m_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 header 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)
Set the print writer. |
void | setShellCommand(String shellCommand)
Sets the command string used to invoke the application |
protected static List | wrap(String text, int width)
Return a list of strings resulting from the wrapping of a supplied
target string. |
See Also: DisplaySetting
See Also: DisplaySetting
Parameters: gutterLeft the string marking left of screen gutterCenter the string marking center of screen gutterRight the string marking right of screen fullWidth the width of the screen
Parameters: gutterLeft the string marking left of screen gutterCenter the string marking center of screen gutterRight the string marking right of screen fullWidth the width of the screen descriptionWidth the minimum description width
Returns: the Comparator used to sort the Group
Returns: the DisplaySettings used to select HelpLines
Returns: the String used as a horizontal section m_divider
Returns: the Exception being documented by this HelpFormatter
Returns: the help screen footer text
Returns: the DisplaySettings used in the full usage string
Returns: the group documented by this HelpFormatter
Returns: the String used as the central gutter
Returns: the String used as the left gutter
Returns: the String used as the right gutter
Returns: the help screen header text
Returns: the DisplaySettings used in the per help line usage strings
Returns: the width of the screen in characters
Returns: the PrintWriter that will be written to
Returns: the command used to execute the application
Parameters: text the text to pad width the padding width writer the writer
Throws: IOException if an I/O error occurs
Throws: IOException if an error occurs
Throws: IOException if an error occurs
Throws: IOException if an error occurs
Throws: IOException if an error occurs
Throws: IOException if an error occurs
Throws: IOException if an error occurs
Parameters: text the string to wrap
Throws: IOException if an error occurs
Parameters: comparator Comparator to use when sorting Options
Parameters: displaySettings the settings to use
See Also: DisplaySetting
Parameters: divider the dividing string
Parameters: exception the exception that occured
Parameters: footer the footer text
Parameters: fullUsageSettings the full usage settings
See Also: DisplaySetting
Parameters: group the options to document
Parameters: header the m_footer text
Parameters: lineUsageSettings the DisplaySettings to use
See Also: DisplaySetting
Parameters: out the PrintWriter to write to
Parameters: shellCommand the invocation command
Parameters: text the target string to wrap width the wrappping width
Returns: the list of wrapped fragments