Package picocli
Class CommandLine.Help.DefaultOptionRenderer
- java.lang.Object
-
- picocli.CommandLine.Help.DefaultOptionRenderer
-
- All Implemented Interfaces:
CommandLine.Help.IOptionRenderer
- Enclosing class:
- CommandLine.Help
static class CommandLine.Help.DefaultOptionRenderer extends java.lang.Object implements CommandLine.Help.IOptionRenderer
The DefaultOptionRenderer convertsOptions
to five columns of text to match the default TextTable column layout. The first row of values looks like this:- the required option marker (if the option is required)
- 2-character short option name (or empty string if no short option exists)
- comma separator (only if both short option and long option exist, empty string otherwise)
- comma-separated string with long option name(s)
- first element of the
CommandLine.Model.ArgSpec.description()
array
Following this, there will be one row for each of the remaining elements of the
CommandLine.Model.ArgSpec.description()
array, and these rows look like{"", "", "", option.description()[i]}
.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
requiredMarker
private java.lang.String
sep
private boolean
showDefaultValues
-
Constructor Summary
Constructors Constructor Description DefaultOptionRenderer(boolean showDefaultValues, java.lang.String requiredMarker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private CommandLine.Help.Ansi.Text
createLongOptionText(CommandLine.Model.OptionSpec option, CommandLine.Help.IParamLabelRenderer renderer, CommandLine.Help.ColorScheme scheme, java.lang.String longOption)
CommandLine.Help.Ansi.Text[][]
render(CommandLine.Model.OptionSpec option, CommandLine.Help.IParamLabelRenderer paramLabelRenderer, CommandLine.Help.ColorScheme scheme)
Returns a text representation of the specified option and its parameter(s) if any.private CommandLine.Help.Ansi.Text[][]
renderDescriptionLines(CommandLine.Model.OptionSpec option, CommandLine.Help.ColorScheme scheme, java.lang.String requiredOption, java.lang.String shortOption, CommandLine.Help.Ansi.Text longOptionText)
-
-
-
Method Detail
-
render
public CommandLine.Help.Ansi.Text[][] render(CommandLine.Model.OptionSpec option, CommandLine.Help.IParamLabelRenderer paramLabelRenderer, CommandLine.Help.ColorScheme scheme)
Description copied from interface:CommandLine.Help.IOptionRenderer
Returns a text representation of the specified option and its parameter(s) if any.- Specified by:
render
in interfaceCommandLine.Help.IOptionRenderer
- Parameters:
option
- the command line option to show online usage help forparamLabelRenderer
- responsible for rendering option parameters to textscheme
- color scheme for applying ansi color styles to options and option parameters- Returns:
- a 2-dimensional array of text values: one or more rows, each containing one or more columns
-
createLongOptionText
private CommandLine.Help.Ansi.Text createLongOptionText(CommandLine.Model.OptionSpec option, CommandLine.Help.IParamLabelRenderer renderer, CommandLine.Help.ColorScheme scheme, java.lang.String longOption)
-
renderDescriptionLines
private CommandLine.Help.Ansi.Text[][] renderDescriptionLines(CommandLine.Model.OptionSpec option, CommandLine.Help.ColorScheme scheme, java.lang.String requiredOption, java.lang.String shortOption, CommandLine.Help.Ansi.Text longOptionText)
-
-