Package ml.options
Class DefaultHelpPrinter
- java.lang.Object
-
- ml.options.DefaultHelpPrinter
-
- All Implemented Interfaces:
HelpPrinter
public class DefaultHelpPrinter extends java.lang.Object implements HelpPrinter
A simple implementation of theHelpPrinter
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 usingOptionData.setValueText()
OptionData.Type.DETAIL
option-D<detail>=<value>
The text value
can be changed usingOptionData.setValueText()
, the textdetail
can be changed usingOptionData.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 usingOptionData.setValueText()
Options.Multiplicity.ZERO_OR_MORE
[-v=<value1> [ -v=<value2> [...]]]
The text value
can be changed usingOptionData.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 Constructor Description DefaultHelpPrinter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 setjava.lang.String
getHelpText(OptionSet set)
Return the help text describing the different options and data arguments
-
-
-
Method Detail
-
getHelpText
public java.lang.String getHelpText(OptionSet set)
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
public 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- 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
-
-