Class CommandLine.Help.DefaultOptionRenderer
- java.lang.Object
-
- org.apache.logging.log4j.core.tools.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.Option.description()
array
Following this, there will be one row for each of the remaining elements of the
CommandLine.Option.description()
array, and these rows look like{"", "", "", option.description()[i]}
.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.Object
command
java.lang.String
requiredMarker
private java.lang.String
sep
private boolean
showDefault
-
Constructor Summary
Constructors Constructor Description DefaultOptionRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.Object
createDefaultValue(java.lang.reflect.Field field)
private CommandLine.Help.Ansi.Text
createLongOptionText(java.lang.reflect.Field field, CommandLine.Help.IParamLabelRenderer renderer, CommandLine.Help.ColorScheme scheme, java.lang.String longOption)
CommandLine.Help.Ansi.Text[][]
render(CommandLine.Option option, java.lang.reflect.Field field, CommandLine.Help.IParamLabelRenderer paramLabelRenderer, CommandLine.Help.ColorScheme scheme)
Returns a text representation of the specified Option and the Field that captures the option value.private CommandLine.Help.Ansi.Text[][]
renderDescriptionLines(CommandLine.Option option, CommandLine.Help.ColorScheme scheme, java.lang.String requiredOption, java.lang.String shortOption, CommandLine.Help.Ansi.Text longOptionText, java.lang.Object defaultValue)
-
-
-
Method Detail
-
render
public CommandLine.Help.Ansi.Text[][] render(CommandLine.Option option, java.lang.reflect.Field field, CommandLine.Help.IParamLabelRenderer paramLabelRenderer, CommandLine.Help.ColorScheme scheme)
Description copied from interface:CommandLine.Help.IOptionRenderer
Returns a text representation of the specified Option and the Field that captures the option value.- Specified by:
render
in interfaceCommandLine.Help.IOptionRenderer
- Parameters:
option
- the command line option to show online usage help forfield
- the field that will hold the value for the command line optionparamLabelRenderer
- 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
-
createDefaultValue
private java.lang.Object createDefaultValue(java.lang.reflect.Field field)
-
createLongOptionText
private CommandLine.Help.Ansi.Text createLongOptionText(java.lang.reflect.Field field, CommandLine.Help.IParamLabelRenderer renderer, CommandLine.Help.ColorScheme scheme, java.lang.String longOption)
-
renderDescriptionLines
private CommandLine.Help.Ansi.Text[][] renderDescriptionLines(CommandLine.Option option, CommandLine.Help.ColorScheme scheme, java.lang.String requiredOption, java.lang.String shortOption, CommandLine.Help.Ansi.Text longOptionText, java.lang.Object defaultValue)
-
-