public class DefaultHelpPrinter extends java.lang.Object implements HelpPrinter
HelpPrinter interface. This can serve as a
basis for more complex formatting requirements.
The following approach is used here for the command line syntax:
| Option Output Format | ||
| Component | Example | Remark |
OptionData.Type.SIMPLE option
| -a
| |
OptionData.Type.VALUE option
| -log <logfile>
| The text logfile can be changed using OptionData.setValueText()
|
OptionData.Type.DETAIL option
| -D<detail>=<value>
| The text value can be changed using OptionData.setValueText(),
the text detail can be changed using OptionData.setDetailText()
|
| Option names with alternate keys | (-a|--Access)
| |
Options.Multiplicity.ZERO_OR_ONCE
| [-a]
| |
Options.Multiplicity.ONCE_OR_MORE
| -v=<value1> [ -v=<value2> [...]]
| The text value can be changed using OptionData.setValueText()
|
Options.Multiplicity.ZERO_OR_MORE
| [-v=<value1> [ -v=<value2> [...]]]
| The text value can be changed using OptionData.setValueText()
|
| Exclusive constraints | { <option1> | <option2> | <option3> }
| <optionN> is a placeholder for the general option syntax described above
which is grouped here using the curly brackets and the pipe symbol
|
| Constructor and Description |
|---|
DefaultHelpPrinter() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCommandLine(OptionSet set,
java.lang.String leadingText,
boolean lineBreak)
Return a string with the command line syntax for the given option set
|
java.lang.String |
getHelpText(OptionSet set)
Return the help text describing the different options and data arguments
|
public java.lang.String getHelpText(OptionSet set)
getHelpText in interface HelpPrinterset - The OptionSet to format the output for
public java.lang.String getCommandLine(OptionSet set, java.lang.String leadingText, boolean lineBreak)
getCommandLine in interface HelpPrinterset - The OptionSet to format the output forleadingText - The text to precede the command linelineBreak - A boolean indicating whether the command line for the option set should
be printed with line breaks after each option or not