Package picocli
Class CommandLine.Help.DefaultParamLabelRenderer
- java.lang.Object
-
- picocli.CommandLine.Help.DefaultParamLabelRenderer
-
- All Implemented Interfaces:
CommandLine.Help.IParamLabelRenderer
- Enclosing class:
- CommandLine.Help
static class CommandLine.Help.DefaultParamLabelRenderer extends java.lang.Object implements CommandLine.Help.IParamLabelRenderer
DefaultParamLabelRenderer separates option parameters from their option names with a separator string, and, unlessCommandLine.Model.ArgSpec.hideParamSyntax()
is true, surrounds optional values with'['
and']'
characters and uses ellipses ("...") to indicate that any number of values is allowed for options or parameters with variable arity.
-
-
Field Summary
Fields Modifier and Type Field Description private CommandLine.Model.CommandSpec
commandSpec
-
Constructor Summary
Constructors Constructor Description DefaultParamLabelRenderer(CommandLine.Model.CommandSpec commandSpec)
Constructs a new DefaultParamLabelRenderer with the specified separator string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CommandLine.Help.Ansi.Text
renderParameterLabel(CommandLine.Model.ArgSpec argSpec, CommandLine.Help.Ansi ansi, java.util.List<CommandLine.Help.Ansi.IStyle> styles)
Returns a text rendering of the option parameter or positional parameter; returns an empty string""
if the option is a boolean and does not take a parameter.java.lang.String
separator()
Returns the separator between option name and param label.
-
-
-
Field Detail
-
commandSpec
private final CommandLine.Model.CommandSpec commandSpec
-
-
Constructor Detail
-
DefaultParamLabelRenderer
public DefaultParamLabelRenderer(CommandLine.Model.CommandSpec commandSpec)
Constructs a new DefaultParamLabelRenderer with the specified separator string.
-
-
Method Detail
-
separator
public java.lang.String separator()
Description copied from interface:CommandLine.Help.IParamLabelRenderer
Returns the separator between option name and param label.- Specified by:
separator
in interfaceCommandLine.Help.IParamLabelRenderer
- Returns:
- the separator between option name and param label
-
renderParameterLabel
public CommandLine.Help.Ansi.Text renderParameterLabel(CommandLine.Model.ArgSpec argSpec, CommandLine.Help.Ansi ansi, java.util.List<CommandLine.Help.Ansi.IStyle> styles)
Description copied from interface:CommandLine.Help.IParamLabelRenderer
Returns a text rendering of the option parameter or positional parameter; returns an empty string""
if the option is a boolean and does not take a parameter.- Specified by:
renderParameterLabel
in interfaceCommandLine.Help.IParamLabelRenderer
- Parameters:
argSpec
- the named or positional parameter with a parameter labelansi
- determines whether ANSI escape codes should be emitted or notstyles
- the styles to apply to the parameter label- Returns:
- a text rendering of the Option parameter or positional parameter
-
-