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 theHelpPrinterinterface. 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.SIMPLEoption-aOptionData.Type.VALUEoption-log <logfile>The text logfilecan be changed usingOptionData.setValueText()OptionData.Type.DETAILoption-D<detail>=<value>The text valuecan be changed usingOptionData.setValueText(), the textdetailcan 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 valuecan be changed usingOptionData.setValueText()Options.Multiplicity.ZERO_OR_MORE[-v=<value1> [ -v=<value2> [...]]]The text valuecan 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.StringgetCommandLine(OptionSet set, java.lang.String leadingText, boolean lineBreak)Return a string with the command line syntax for the given option setjava.lang.StringgetHelpText(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:
getHelpTextin interfaceHelpPrinter- Parameters:
set- TheOptionSetto 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:
getCommandLinein interfaceHelpPrinter- Parameters:
set- TheOptionSetto 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
-
-