public static class CommandLine.Model.UsageMessageSpec extends Object
This class provides two ways to customize the usage help message:
The pre-defined sections have getters and setters that return a String (or array of Strings). For example:
description()
and description(String...)
or header()
and header(String...)
.
Changing the section order, or adding custom sections can be accomplished with sectionKeys(List)
and sectionMap(Map)
.
This gives complete freedom on how a usage help message section is rendered, but it also means that the section renderer
is responsible for all aspects of rendering the section, including layout and emitting ANSI escape codes.
The CommandLine.Help.TextTable
and CommandLine.Help.Ansi.Text
classes, and the CommandLine.Help.Ansi.string(String)
and CommandLine.Help.Ansi.text(String)
methods may be useful.
The usage help message is created more or less like this:
// CommandLine.usage(...) or CommandLine.getUsageMessage(...) Help.ColorScheme colorScheme = Help.defaultColorScheme(Help.Ansi.AUTO); Help help = getHelpFactory().create(getCommandSpec(), colorScheme) StringBuilder result = new StringBuilder(); for (String key : getHelpSectionKeys()) { IHelpSectionRenderer renderer = getHelpSectionMap().get(key); if (renderer != null) { result.append(renderer.render(help)); } } // return or print result
Where the default help section map is constructed like this:
// The default section renderers delegate to methods in Help for their implementation
// (using Java 8 lambda notation for brevity):
Map<String, IHelpSectionRenderer> sectionMap = new HashMap<>();
sectionMap.put(SECTION_KEY_HEADER_HEADING, help -> help.headerHeading());
sectionMap.put(SECTION_KEY_HEADER, help -> help.header());
sectionMap.put(SECTION_KEY_SYNOPSIS_HEADING, help -> help.synopsisHeading()); //e.g. Usage:
sectionMap.put(SECTION_KEY_SYNOPSIS, help -> help.synopsis(help.synopsisHeadingLength())); //e.g. <cmd> [OPTIONS] <subcmd> [COMMAND-OPTIONS] [ARGUMENTS]
sectionMap.put(SECTION_KEY_DESCRIPTION_HEADING, help -> help.descriptionHeading()); //e.g. %nDescription:%n%n
sectionMap.put(SECTION_KEY_DESCRIPTION, help -> help.description()); //e.g. {"Converts foos to bars.", "Use options to control conversion mode."}
sectionMap.put(SECTION_KEY_PARAMETER_LIST_HEADING, help -> help.parameterListHeading()); //e.g. %nPositional parameters:%n%n
sectionMap.put(SECTION_KEY_PARAMETER_LIST, help -> help.parameterList()); //e.g. [FILE...] the files to convert
sectionMap.put(SECTION_KEY_OPTION_LIST_HEADING, help -> help.optionListHeading()); //e.g. %nOptions:%n%n
sectionMap.put(SECTION_KEY_OPTION_LIST, help -> help.optionList()); //e.g. -h, --help displays this help and exits
sectionMap.put(SECTION_KEY_COMMAND_LIST_HEADING, help -> help.commandListHeading()); //e.g. %nCommands:%n%n
sectionMap.put(SECTION_KEY_COMMAND_LIST, help -> help.commandList()); //e.g. add adds the frup to the frooble
sectionMap.put(SECTION_KEY_EXIT_CODE_LIST_HEADING, help -> help.exitCodeListHeading());
sectionMap.put(SECTION_KEY_EXIT_CODE_LIST, help -> help.exitCodeList());
sectionMap.put(SECTION_KEY_FOOTER_HEADING, help -> help.footerHeading());
sectionMap.put(SECTION_KEY_FOOTER, help -> help.footer());
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_USAGE_WIDTH
Constant holding the default usage message width:
80 . |
static String |
SECTION_KEY_AT_FILE_PARAMETER
|
static String |
SECTION_KEY_COMMAND_LIST
|
static String |
SECTION_KEY_COMMAND_LIST_HEADING
|
static String |
SECTION_KEY_DESCRIPTION
|
static String |
SECTION_KEY_DESCRIPTION_HEADING
|
static String |
SECTION_KEY_END_OF_OPTIONS
|
static String |
SECTION_KEY_EXIT_CODE_LIST
|
static String |
SECTION_KEY_EXIT_CODE_LIST_HEADING
|
static String |
SECTION_KEY_FOOTER
|
static String |
SECTION_KEY_FOOTER_HEADING
|
static String |
SECTION_KEY_HEADER
|
static String |
SECTION_KEY_HEADER_HEADING
|
static String |
SECTION_KEY_OPTION_LIST
|
static String |
SECTION_KEY_OPTION_LIST_HEADING
|
static String |
SECTION_KEY_PARAMETER_LIST
|
static String |
SECTION_KEY_PARAMETER_LIST_HEADING
|
static String |
SECTION_KEY_SYNOPSIS
|
static String |
SECTION_KEY_SYNOPSIS_HEADING
|
Constructor and Description |
---|
UsageMessageSpec() |
Modifier and Type | Method and Description |
---|---|
boolean |
abbreviateSynopsis()
Returns whether the synopsis line(s) should show an abbreviated synopsis without detailed option names.
|
CommandLine.Model.UsageMessageSpec |
abbreviateSynopsis(boolean newValue)
Sets whether the synopsis line(s) should show an abbreviated synopsis without detailed option names.
|
boolean |
adjustLineBreaksForWideCJKCharacters()
Returns whether line breaks should take wide Chinese, Japanese and Korean characters into account for line-breaking purposes.
|
CommandLine.Model.UsageMessageSpec |
adjustLineBreaksForWideCJKCharacters(boolean adjustForWideChars)
Sets whether line breaks should take wide Chinese, Japanese and Korean characters into account, and returns this UsageMessageSpec.
|
boolean |
autoWidth()
Returns whether picocli should attempt to detect the terminal size and adjust the usage help message width
to take the full terminal width.
|
CommandLine.Model.UsageMessageSpec |
autoWidth(boolean detectTerminalSize)
Sets whether picocli should attempt to detect the terminal size and adjust the usage help message width
to take the full terminal width.
|
String |
commandListHeading()
Returns the optional heading preceding the subcommand list.
|
CommandLine.Model.UsageMessageSpec |
commandListHeading(String newValue)
Sets the optional heading preceding the subcommand list.
|
String[] |
customSynopsis()
Returns the optional custom synopsis lines to use instead of the auto-generated synopsis.
|
CommandLine.Model.UsageMessageSpec |
customSynopsis(String... customSynopsis)
Sets the optional custom synopsis lines to use instead of the auto-generated synopsis.
|
String[] |
description()
Returns the optional text lines to use as the description of the help message, displayed between the synopsis and the
options list.
|
CommandLine.Model.UsageMessageSpec |
description(String... description)
Sets the optional text lines to use as the description of the help message, displayed between the synopsis and the
options list.
|
String |
descriptionHeading()
Returns the optional heading preceding the description section.
|
CommandLine.Model.UsageMessageSpec |
descriptionHeading(String newValue)
Sets the heading preceding the description section.
|
Map<String,String> |
exitCodeList()
Returns an unmodifiable map with values to be displayed in the exit codes section: keys are exit codes, values are descriptions.
|
CommandLine.Model.UsageMessageSpec |
exitCodeList(Map<String,String> newValue)
Sets the values to be displayed in the exit codes section: keys are exit codes, values are descriptions.
|
String |
exitCodeListHeading()
Returns the optional heading preceding the exit codes section, may contain
"%n" line separators. |
CommandLine.Model.UsageMessageSpec |
exitCodeListHeading(String newValue)
Sets the optional heading preceding the exit codes section, may contain
"%n" line separators. |
String[] |
footer()
Returns the optional footer text lines displayed at the bottom of the help message.
|
CommandLine.Model.UsageMessageSpec |
footer(String... footer)
Sets the optional footer text lines displayed at the bottom of the help message.
|
String |
footerHeading()
Returns the optional heading preceding the footer section.
|
CommandLine.Model.UsageMessageSpec |
footerHeading(String newValue)
Sets the optional heading preceding the footer section.
|
String[] |
header()
Returns the optional header lines displayed at the top of the help message.
|
CommandLine.Model.UsageMessageSpec |
header(String... header)
Sets the optional header lines displayed at the top of the help message.
|
String |
headerHeading()
Returns the optional heading preceding the header section.
|
CommandLine.Model.UsageMessageSpec |
headerHeading(String headerHeading)
Sets the heading preceding the header section.
|
CommandLine.IHelpFactory |
helpFactory()
Returns the
IHelpFactory that is used to construct the usage help message. |
CommandLine.Model.UsageMessageSpec |
helpFactory(CommandLine.IHelpFactory helpFactory)
Sets a new
IHelpFactory to customize the usage help message. |
boolean |
hidden()
Returns whether this command should be hidden from the usage help message of the parent command.
|
CommandLine.Model.UsageMessageSpec |
hidden(boolean value)
Set the hidden flag on this command to control whether to show or hide it in the help usage text of the parent command.
|
static Map<String,String> |
keyValuesMap(String... entries)
Creates and returns a
Map that contains an entry for each specified String that is in "key:value" format. |
int |
longOptionsMaxWidth()
Returns the maximum usage help long options column max width to the specified value.
|
CommandLine.Model.UsageMessageSpec |
longOptionsMaxWidth(int newValue)
Sets the maximum usage help long options column max width to the specified value.
|
CommandLine.Model.Messages |
messages()
Returns the Messages for this usage help message specification, or
null . |
CommandLine.Model.UsageMessageSpec |
messages(CommandLine.Model.Messages msgs)
Sets the Messages for this usageMessage specification, and returns this UsageMessageSpec.
|
String |
optionListHeading()
Returns the optional heading preceding the options list.
|
CommandLine.Model.UsageMessageSpec |
optionListHeading(String newValue)
Sets the heading preceding the options list.
|
String |
parameterListHeading()
Returns the optional heading preceding the parameter list.
|
CommandLine.Model.UsageMessageSpec |
parameterListHeading(String newValue)
Sets the optional heading preceding the parameter list.
|
char |
requiredOptionMarker()
Returns the character used to prefix required options in the options list.
|
CommandLine.Model.UsageMessageSpec |
requiredOptionMarker(char newValue)
Sets the character used to prefix required options in the options list.
|
List<String> |
sectionKeys()
Returns the section keys in the order that the usage help message should render the sections.
|
CommandLine.Model.UsageMessageSpec |
sectionKeys(List<String> keys)
Sets the section keys in the order that the usage help message should render the sections.
|
Map<String,CommandLine.IHelpSectionRenderer> |
sectionMap()
Returns the map of section keys and renderers used to construct the usage help message.
|
CommandLine.Model.UsageMessageSpec |
sectionMap(Map<String,CommandLine.IHelpSectionRenderer> map)
Sets the map of section keys and renderers used to construct the usage help message to a copy of the specified map.
|
boolean |
showAtFileInUsageHelp()
Sets whether to show a
[@<filename>...] entry in the synopsis and parameter list of the usage help message. |
CommandLine.Model.UsageMessageSpec |
showAtFileInUsageHelp(boolean newValue)
Sets whether to show a
[@<filename>...] entry in the synopsis and parameter list of the usage help message. |
boolean |
showDefaultValues()
Returns whether the options list in the usage help message should show default values for all non-boolean options.
|
CommandLine.Model.UsageMessageSpec |
showDefaultValues(boolean newValue)
Sets whether the options list in the usage help message should show default values for all non-boolean options.
|
boolean |
showEndOfOptionsDelimiterInUsageHelp()
Sets whether to show a
[--] (End of Options) entry in the synopsis and options list of the usage help message. |
CommandLine.Model.UsageMessageSpec |
showEndOfOptionsDelimiterInUsageHelp(boolean newValue)
Sets whether to show a
[--] (End of Options) entry in the synopsis and options list of the usage help message. |
boolean |
sortOptions()
Returns whether the options list in the usage help message should be sorted alphabetically.
|
CommandLine.Model.UsageMessageSpec |
sortOptions(boolean newValue)
Sets whether the options list in the usage help message should be sorted alphabetically.
|
boolean |
sortSynopsis()
Returns whether the options in the synopsis should be sorted alphabetically.
|
CommandLine.Model.UsageMessageSpec |
sortSynopsis(boolean newValue)
Sets whether the options in the synopsis should be sorted alphabetically.
|
double |
synopsisAutoIndentThreshold()
Returns the fraction of the usage help
width() that is the threshold up to which
the 2nd line and subsequent lines of a multi-line synopsis should be aligned to the end of the command name. |
CommandLine.Model.UsageMessageSpec |
synopsisAutoIndentThreshold(double newValue)
Sets the fraction of the usage help
width() that is the threshold up to which
the 2nd line and subsequent lines of a multi-line synopsis should be aligned to the end of the command name. |
String |
synopsisHeading()
Returns the optional heading preceding the synopsis.
|
CommandLine.Model.UsageMessageSpec |
synopsisHeading(String newValue)
Sets the optional heading preceding the synopsis.
|
int |
synopsisIndent()
Returns the indentation to use on the 2nd line and subsequent lines of a multi-line synopsis
when the length of the synopsis heading and the fully qualified command name exceed the
width() times the synopsisAutoIndentThreshold() , -1 by default. |
CommandLine.Model.UsageMessageSpec |
synopsisIndent(int newValue)
Sets the indentation to use on the 2nd line and subsequent lines of a multi-line synopsis
when the length of the synopsis heading and the fully qualified command name exceed the
synopsisAutoIndentThreshold() fraction of the width() , -1 by default. |
String |
synopsisSubcommandLabel()
Returns the String representing the subcommands in the synopsis.
|
CommandLine.Model.UsageMessageSpec |
synopsisSubcommandLabel(String newValue)
Sets the String representing the subcommands in the synopsis.
|
int |
width()
Returns the maximum usage help message width.
|
CommandLine.Model.UsageMessageSpec |
width(int newValue)
Sets the maximum usage help message width to the specified value.
|
public static final String SECTION_KEY_HEADER_HEADING
CommandLine.Help.headerHeading(Object...)
.public static final String SECTION_KEY_HEADER
CommandLine.Help.header(Object...)
.public static final String SECTION_KEY_SYNOPSIS_HEADING
CommandLine.Help.synopsisHeading(Object...)
.public static final String SECTION_KEY_SYNOPSIS
CommandLine.Help.synopsis(int)
.public static final String SECTION_KEY_DESCRIPTION_HEADING
CommandLine.Help.descriptionHeading(Object...)
.public static final String SECTION_KEY_DESCRIPTION
CommandLine.Help.description(Object...)
.public static final String SECTION_KEY_PARAMETER_LIST_HEADING
CommandLine.Help.parameterListHeading(Object...)
.public static final String SECTION_KEY_AT_FILE_PARAMETER
CommandLine.Help.atFileParameterList()
.public static final String SECTION_KEY_PARAMETER_LIST
CommandLine.Help.parameterList()
.public static final String SECTION_KEY_OPTION_LIST_HEADING
CommandLine.Help.optionListHeading(Object...)
.public static final String SECTION_KEY_OPTION_LIST
CommandLine.Help.optionList()
.public static final String SECTION_KEY_END_OF_OPTIONS
--
End of Options list section.
The default renderer for this section calls CommandLine.Help.endOfOptionsList()
.public static final String SECTION_KEY_COMMAND_LIST_HEADING
CommandLine.Help.commandListHeading(Object...)
.public static final String SECTION_KEY_COMMAND_LIST
CommandLine.Help.commandList()
.public static final String SECTION_KEY_EXIT_CODE_LIST_HEADING
CommandLine.Help.exitCodeListHeading(Object...)
.public static final String SECTION_KEY_EXIT_CODE_LIST
CommandLine.Help.exitCodeList()
.public static final String SECTION_KEY_FOOTER_HEADING
CommandLine.Help.footerHeading(Object...)
.public static final String SECTION_KEY_FOOTER
CommandLine.Help.footer(Object...)
.public static final int DEFAULT_USAGE_WIDTH
80
.public CommandLine.Model.UsageMessageSpec width(int newValue)
newValue
- the new maximum usage help message width. Must be 55 or greater.UsageMessageSpec
for method chainingIllegalArgumentException
- if the specified width is less than 55public CommandLine.Model.UsageMessageSpec longOptionsMaxWidth(int newValue)
newValue
- the new maximum usage help long options column max width. Must be 20 or greater, otherwise the new value will be ignored.UsageMessageSpec
for method chainingpublic int width()
"picocli.usage.width"
if set, otherwise returns the value set via the width(int)
method, or if not set, the default width.public int longOptionsMaxWidth()
public boolean autoWidth()
"picocli.usage.width"
to AUTO
,
and may disable this by setting this system property to a numeric value.
This feature requires Java 7 or greater. The default is false
.CommandLine.Command.usageHelpAutoWidth()
public CommandLine.Model.UsageMessageSpec autoWidth(boolean detectTerminalSize)
false
.detectTerminalSize
- whether picocli should attempt to detect the terminal sizeCommandLine.Command.usageHelpAutoWidth()
public List<String> sectionKeys()
sectionKeys setter
. The default keys are (in order):
SECTION_KEY_HEADER_HEADING
SECTION_KEY_HEADER
SECTION_KEY_SYNOPSIS_HEADING
SECTION_KEY_SYNOPSIS
SECTION_KEY_DESCRIPTION_HEADING
SECTION_KEY_DESCRIPTION
SECTION_KEY_PARAMETER_LIST_HEADING
SECTION_KEY_AT_FILE_PARAMETER
SECTION_KEY_PARAMETER_LIST
SECTION_KEY_OPTION_LIST_HEADING
SECTION_KEY_OPTION_LIST
SECTION_KEY_END_OF_OPTIONS
SECTION_KEY_COMMAND_LIST_HEADING
SECTION_KEY_COMMAND_LIST
SECTION_KEY_EXIT_CODE_LIST_HEADING
SECTION_KEY_EXIT_CODE_LIST
SECTION_KEY_FOOTER_HEADING
SECTION_KEY_FOOTER
public CommandLine.Model.UsageMessageSpec sectionKeys(List<String> keys)
sectionKeys
public Map<String,CommandLine.IHelpSectionRenderer> sectionMap()
sectionKeys setter
.
Sections that are either not in this map or not in the list returned by sectionKeys
are omitted.sectionKeys
public CommandLine.Model.UsageMessageSpec sectionMap(Map<String,CommandLine.IHelpSectionRenderer> map)
map
- the mapping of section keys to their renderers, must be non-null
.sectionKeys
,
CommandLine.setHelpSectionMap(Map)
public CommandLine.IHelpFactory helpFactory()
IHelpFactory
that is used to construct the usage help message.CommandLine.setHelpFactory(IHelpFactory)
public CommandLine.Model.UsageMessageSpec helpFactory(CommandLine.IHelpFactory helpFactory)
IHelpFactory
to customize the usage help message.helpFactory
- the new help factory. Must be non-null
.UsageMessageSpec
object, to allow method chainingpublic String headerHeading()
CommandLine.Command.headerHeading()
, or ""
(empty string).public String[] header()
CommandLine.Command.header()
if the Command
annotation is present, otherwise this is an empty array and the help message has no
header. Applications may programmatically set this field to create a custom help message.public String synopsisHeading()
CommandLine.Command.synopsisHeading()
, "Usage: "
by default.public String synopsisSubcommandLabel()
CommandLine.Command.synopsisSubcommandLabel()
, "[COMMANDS]"
by default.public double synopsisAutoIndentThreshold()
width()
that is the threshold up to which
the 2nd line and subsequent lines of a multi-line synopsis should be aligned to the end of the command name.
The default value of this attribute is 0.5
.
If the length of the synopsis heading plus the length of the fully qualified command name exceeds this fraction of the width,
the 2nd and subsequent rows of a multi-line synopsis will be aligned to the synopsisIndent()
instead of the end of the command name.public int synopsisIndent()
width()
times the synopsisAutoIndentThreshold()
, -1
by default.
A negative value for this option means that the 2nd line and subsequent lines are aligned to the synopsis heading length.
A positive value means the exact number of spaces to indent for the 2nd line and subsequent lines of the synopsis.public boolean abbreviateSynopsis()
public String[] customSynopsis()
CommandLine.Command.customSynopsis()
if the Command
annotation is present,
otherwise this is an empty array and the synopsis is generated.
Applications may programmatically set this field to create a custom help message.public String descriptionHeading()
CommandLine.Command.descriptionHeading()
, or null.public String[] description()
CommandLine.Command.description()
if the Command
annotation is present,
otherwise this is an empty array and the help message has no description.
Applications may programmatically set this field to create a custom help message.public String parameterListHeading()
CommandLine.Command.parameterListHeading()
, or null.public String optionListHeading()
CommandLine.Command.optionListHeading()
, or null.public boolean sortOptions()
public boolean sortSynopsis()
public char requiredOptionMarker()
public boolean showDefaultValues()
public boolean showAtFileInUsageHelp()
[@<filename>...]
entry in the synopsis and parameter list of the usage help message.
(The entry is not shown if expanding parameter files is disabled.)CommandLine.Command.showAtFileInUsageHelp()
public boolean showEndOfOptionsDelimiterInUsageHelp()
[--]
(End of Options) entry in the synopsis and options list of the usage help message.CommandLine.Command.showEndOfOptionsDelimiterInUsageHelp()
public boolean hidden()
true
if this command should not appear in the usage help message of the parent commandpublic String commandListHeading()
CommandLine.Command.commandListHeading()
. "Commands:%n"
by default.public String exitCodeListHeading()
"%n"
line separators. ""
(empty string) by default.public Map<String,String> exitCodeList()
"%n"
line separators.
Callers may be interested in the keyValuesMap
method for creating a map from a list of "key:value"
Strings.
This may be configured in a resource bundle by listing up multiple "key:value"
pairs. For example:
usage.exitCodeList.0 = 0:Successful program execution. usage.exitCodeList.1 = 64:Invalid input: an unknown option or invalid parameter was specified. usage.exitCodeList.2 = 70:Execution exception: an exception occurred while executing the business logic.
keyValuesMap(String...)
public static Map<String,String> keyValuesMap(String... entries)
Map
that contains an entry for each specified String that is in "key:value"
format.entries
- the strings to process; values that are not in "key:value"
format are ignoredMap
with an entry for each line, preserving the input orderpublic String footerHeading()
CommandLine.Command.footerHeading()
, or ""
(empty string).public String[] footer()
CommandLine.Command.footer()
if the Command
annotation is present, otherwise this is an empty array and
the help message has no footer.
Applications may programmatically set this field to create a custom help message.public CommandLine.Model.UsageMessageSpec headerHeading(String headerHeading)
CommandLine.Command.headerHeading()
, or null.public CommandLine.Model.UsageMessageSpec header(String... header)
public CommandLine.Model.UsageMessageSpec synopsisHeading(String newValue)
public CommandLine.Model.UsageMessageSpec synopsisSubcommandLabel(String newValue)
public CommandLine.Model.UsageMessageSpec synopsisAutoIndentThreshold(double newValue)
width()
that is the threshold up to which
the 2nd line and subsequent lines of a multi-line synopsis should be aligned to the end of the command name.
The default value of this attribute is 0.5
.
If the length of the synopsis heading plus the length of the fully qualified command name exceeds this fraction of the width,
the 2nd and subsequent rows of a multi-line synopsis will be aligned to the synopsisIndent()
instead of the end of the command name.newValue
- the new threshold value. Must be a value between 0.0 and 0.9, inclusiveIllegalArgumentException
- if the specified value is less than 0.0 or greater than 0.9public CommandLine.Model.UsageMessageSpec synopsisIndent(int newValue)
synopsisAutoIndentThreshold()
fraction of the width()
, -1
by default.
A negative value for this option means that the 2nd line and subsequent lines are aligned to the synopsis heading length.
A positive value means the exact number of spaces to indent for the 2nd line and subsequent lines of the synopsis.public CommandLine.Model.UsageMessageSpec abbreviateSynopsis(boolean newValue)
public CommandLine.Model.UsageMessageSpec customSynopsis(String... customSynopsis)
public CommandLine.Model.UsageMessageSpec descriptionHeading(String newValue)
public CommandLine.Model.UsageMessageSpec description(String... description)
public CommandLine.Model.UsageMessageSpec parameterListHeading(String newValue)
public CommandLine.Model.UsageMessageSpec optionListHeading(String newValue)
public CommandLine.Model.UsageMessageSpec sortOptions(boolean newValue)
public CommandLine.Model.UsageMessageSpec sortSynopsis(boolean newValue)
public CommandLine.Model.UsageMessageSpec requiredOptionMarker(char newValue)
public CommandLine.Model.UsageMessageSpec showDefaultValues(boolean newValue)
public CommandLine.Model.UsageMessageSpec showAtFileInUsageHelp(boolean newValue)
[@<filename>...]
entry in the synopsis and parameter list of the usage help message.
(The entry is not shown if expanding parameter files is disabled.)CommandLine.Command.showAtFileInUsageHelp()
public CommandLine.Model.UsageMessageSpec showEndOfOptionsDelimiterInUsageHelp(boolean newValue)
[--]
(End of Options) entry in the synopsis and options list of the usage help message.CommandLine.Command.showEndOfOptionsDelimiterInUsageHelp()
public CommandLine.Model.UsageMessageSpec hidden(boolean value)
value
- enable or disable the hidden flagCommandLine.Command.hidden()
public CommandLine.Model.UsageMessageSpec commandListHeading(String newValue)
public CommandLine.Model.UsageMessageSpec exitCodeListHeading(String newValue)
"%n"
line separators. ""
(empty string) by default.public CommandLine.Model.UsageMessageSpec exitCodeList(Map<String,String> newValue)
"%n"
line separators.
This may be configured in a resource bundle by listing up multiple "key:value"
pairs. For example:
usage.exitCodeList.0 = 0:Successful program execution. usage.exitCodeList.1 = 64:Invalid input: an unknown option or invalid parameter was specified. usage.exitCodeList.2 = 70:Execution exception: an exception occurred while executing the business logic.
newValue
- a map with values to be displayed in the exit codes sectionkeyValuesMap(String...)
public CommandLine.Model.UsageMessageSpec footerHeading(String newValue)
public CommandLine.Model.UsageMessageSpec footer(String... footer)
public CommandLine.Model.Messages messages()
null
.public CommandLine.Model.UsageMessageSpec messages(CommandLine.Model.Messages msgs)
msgs
- the new Messages value that encapsulates this command's resource bundle, may be null
public boolean adjustLineBreaksForWideCJKCharacters()
public CommandLine.Model.UsageMessageSpec adjustLineBreaksForWideCJKCharacters(boolean adjustForWideChars)
adjustForWideChars
- if true, wide Chinese, Japanese and Korean characters are counted as double the size of other characters for line-breaking purposes