Package ml.options
Class DefaultHelpPrinter
java.lang.Object
ml.options.DefaultHelpPrinter
- All Implemented Interfaces:
HelpPrinter
A simple implementation of the
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCommandLine
(OptionSet set, String leadingText, boolean lineBreak) Return a string with the command line syntax for the given option setgetHelpText
(OptionSet set) Return the help text describing the different options and data arguments
-
Constructor Details
-
DefaultHelpPrinter
public DefaultHelpPrinter()
-
-
Method Details
-
getHelpText
Return the help text describing the different options and data arguments- Specified by:
getHelpText
in interfaceHelpPrinter
- Parameters:
set
- TheOptionSet
to format the output for- Returns:
- A string with the help text for this option set
-
getCommandLine
Return a string with the command line syntax for the given option set- Specified by:
getCommandLine
in interfaceHelpPrinter
- Parameters:
set
- TheOptionSet
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- Returns:
- A string with the command line syntax for this option set
-