Package picocli
Class CommandLine.Help.ColorScheme.Builder
- java.lang.Object
-
- picocli.CommandLine.Help.ColorScheme.Builder
-
- Enclosing class:
- CommandLine.Help.ColorScheme
public static class CommandLine.Help.ColorScheme.Builder extends java.lang.Object
Builder class to createColorScheme
instances.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description private CommandLine.Help.Ansi
ansi
private java.util.List<CommandLine.Help.Ansi.IStyle>
commandStyles
private java.util.List<CommandLine.Help.Ansi.IStyle>
errorStyles
private java.util.Map<java.lang.String,CommandLine.Help.Ansi.IStyle>
markupMap
private java.util.List<CommandLine.Help.Ansi.IStyle>
optionParamStyles
private java.util.List<CommandLine.Help.Ansi.IStyle>
optionStyles
private java.util.List<CommandLine.Help.Ansi.IStyle>
parameterStyles
private java.util.List<CommandLine.Help.Ansi.IStyle>
stackTraceStyles
-
Constructor Summary
Constructors Constructor Description Builder()
Constructs an empty color scheme builder with Ansi.AUTO.Builder(CommandLine.Help.Ansi ansi)
Constructs an empty color scheme builder with the specified Ansi value.Builder(CommandLine.Help.ColorScheme existing)
Constructs a color scheme builder with all attributes copied from the specified color scheme.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private CommandLine.Help.ColorScheme.Builder
addAll(java.util.List<CommandLine.Help.Ansi.IStyle> styles, CommandLine.Help.Ansi.IStyle... add)
CommandLine.Help.Ansi
ansi()
Returns theAnsi
setting of this color scheme builder.CommandLine.Help.ColorScheme.Builder
ansi(CommandLine.Help.Ansi ansi)
Returns theAnsi
setting of this color scheme builder.CommandLine.Help.ColorScheme.Builder
applySystemProperties()
Replaces colors and styles in this scheme builder with ones specified in system properties, and returns this builder.CommandLine.Help.ColorScheme
build()
Creates and returns a newColorScheme
with the values configured on this builder.CommandLine.Help.ColorScheme.Builder
commands(CommandLine.Help.Ansi.IStyle... styles)
Adds the specified styles to the registered styles for commands in this color scheme builder and returns this builder.java.util.List<CommandLine.Help.Ansi.IStyle>
commandStyles()
Returns the registered styles for commands in this color scheme builder.java.util.Map<java.lang.String,CommandLine.Help.Ansi.IStyle>
customMarkupMap()
Returns the custom mapping from markup names (the names of theCommandLine.Help.Ansi.Style
enum constants, like bold, italic, fg_blue, bg_green, etc) toCommandLine.Help.Ansi.IStyle
objects in this color scheme.CommandLine.Help.ColorScheme.Builder
customMarkupMap(java.util.Map<java.lang.String,CommandLine.Help.Ansi.IStyle> newValue)
Sets the custom mapping from markup names (the names of theCommandLine.Help.Ansi.Style
enum constants, like bold, italic, fg_blue, bg_green, etc) toCommandLine.Help.Ansi.IStyle
objects in this color scheme.CommandLine.Help.ColorScheme.Builder
errors(CommandLine.Help.Ansi.IStyle... styles)
Adds the specified styles to the registered styles for errors in this color scheme builder and returns this builder.java.util.List<CommandLine.Help.Ansi.IStyle>
errorStyles()
Returns the registered styles for errors in this color scheme builder.CommandLine.Help.ColorScheme.Builder
optionParams(CommandLine.Help.Ansi.IStyle... styles)
Adds the specified styles to the registered styles for option parameters in this color scheme builder and returns this builder.java.util.List<CommandLine.Help.Ansi.IStyle>
optionParamStyles()
Returns the registered styles for option parameters in this color scheme builder.CommandLine.Help.ColorScheme.Builder
options(CommandLine.Help.Ansi.IStyle... styles)
Adds the specified styles to the registered styles for options in this color scheme and returns this color scheme.java.util.List<CommandLine.Help.Ansi.IStyle>
optionStyles()
Returns the registered styles for options in this color scheme builder.CommandLine.Help.ColorScheme.Builder
parameters(CommandLine.Help.Ansi.IStyle... styles)
Adds the specified styles to the registered styles for positional parameters in this color scheme builder and returns this builder.java.util.List<CommandLine.Help.Ansi.IStyle>
parameterStyles()
Returns the registered styles for positional parameters in this color scheme builder.private void
replace(java.util.List<CommandLine.Help.Ansi.IStyle> styles, java.lang.String property)
CommandLine.Help.ColorScheme.Builder
stackTraces(CommandLine.Help.Ansi.IStyle... styles)
Adds the specified styles to the registered styles for stack traces in this color scheme builder and returns this builder.java.util.List<CommandLine.Help.Ansi.IStyle>
stackTraceStyles()
Returns the registered styles for stack traces in this color scheme builder.
-
-
-
Field Detail
-
commandStyles
private final java.util.List<CommandLine.Help.Ansi.IStyle> commandStyles
-
optionStyles
private final java.util.List<CommandLine.Help.Ansi.IStyle> optionStyles
-
parameterStyles
private final java.util.List<CommandLine.Help.Ansi.IStyle> parameterStyles
-
optionParamStyles
private final java.util.List<CommandLine.Help.Ansi.IStyle> optionParamStyles
-
errorStyles
private final java.util.List<CommandLine.Help.Ansi.IStyle> errorStyles
-
stackTraceStyles
private final java.util.List<CommandLine.Help.Ansi.IStyle> stackTraceStyles
-
ansi
private CommandLine.Help.Ansi ansi
-
markupMap
private java.util.Map<java.lang.String,CommandLine.Help.Ansi.IStyle> markupMap
-
-
Constructor Detail
-
Builder
public Builder()
Constructs an empty color scheme builder with Ansi.AUTO.
-
Builder
public Builder(CommandLine.Help.Ansi ansi)
Constructs an empty color scheme builder with the specified Ansi value.
-
Builder
public Builder(CommandLine.Help.ColorScheme existing)
Constructs a color scheme builder with all attributes copied from the specified color scheme.
-
-
Method Detail
-
ansi
public CommandLine.Help.Ansi ansi()
Returns theAnsi
setting of this color scheme builder.
-
ansi
public CommandLine.Help.ColorScheme.Builder ansi(CommandLine.Help.Ansi ansi)
Returns theAnsi
setting of this color scheme builder.
-
commandStyles
public java.util.List<CommandLine.Help.Ansi.IStyle> commandStyles()
Returns the registered styles for commands in this color scheme builder.
-
optionStyles
public java.util.List<CommandLine.Help.Ansi.IStyle> optionStyles()
Returns the registered styles for options in this color scheme builder.
-
parameterStyles
public java.util.List<CommandLine.Help.Ansi.IStyle> parameterStyles()
Returns the registered styles for positional parameters in this color scheme builder.
-
optionParamStyles
public java.util.List<CommandLine.Help.Ansi.IStyle> optionParamStyles()
Returns the registered styles for option parameters in this color scheme builder.
-
errorStyles
public java.util.List<CommandLine.Help.Ansi.IStyle> errorStyles()
Returns the registered styles for errors in this color scheme builder.- Since:
- 4.3
-
stackTraceStyles
public java.util.List<CommandLine.Help.Ansi.IStyle> stackTraceStyles()
Returns the registered styles for stack traces in this color scheme builder.- Since:
- 4.3
-
customMarkupMap
public java.util.Map<java.lang.String,CommandLine.Help.Ansi.IStyle> customMarkupMap()
Returns the custom mapping from markup names (the names of theCommandLine.Help.Ansi.Style
enum constants, like bold, italic, fg_blue, bg_green, etc) toCommandLine.Help.Ansi.IStyle
objects in this color scheme. By default this returnsnull
, unless a custom map was configured.- Since:
- 4.2
-
customMarkupMap
public CommandLine.Help.ColorScheme.Builder customMarkupMap(java.util.Map<java.lang.String,CommandLine.Help.Ansi.IStyle> newValue)
Sets the custom mapping from markup names (the names of theCommandLine.Help.Ansi.Style
enum constants, like bold, italic, fg_blue, bg_green, etc) toCommandLine.Help.Ansi.IStyle
objects in this color scheme.- Returns:
- this color scheme builder to enable method chaining for a more fluent API
- Since:
- 4.2
-
commands
public CommandLine.Help.ColorScheme.Builder commands(CommandLine.Help.Ansi.IStyle... styles)
Adds the specified styles to the registered styles for commands in this color scheme builder and returns this builder.- Parameters:
styles
- the styles to add to the registered styles for commands in this color scheme builder- Returns:
- this color scheme builder to enable method chaining for a more fluent API
-
options
public CommandLine.Help.ColorScheme.Builder options(CommandLine.Help.Ansi.IStyle... styles)
Adds the specified styles to the registered styles for options in this color scheme and returns this color scheme.- Parameters:
styles
- the styles to add to registered the styles for options in this color scheme builder- Returns:
- this color scheme builder to enable method chaining for a more fluent API
-
parameters
public CommandLine.Help.ColorScheme.Builder parameters(CommandLine.Help.Ansi.IStyle... styles)
Adds the specified styles to the registered styles for positional parameters in this color scheme builder and returns this builder.- Parameters:
styles
- the styles to add to registered the styles for parameters in this color scheme builder- Returns:
- this color scheme builder to enable method chaining for a more fluent API
-
optionParams
public CommandLine.Help.ColorScheme.Builder optionParams(CommandLine.Help.Ansi.IStyle... styles)
Adds the specified styles to the registered styles for option parameters in this color scheme builder and returns this builder.- Parameters:
styles
- the styles to add to the registered styles for option parameters in this color scheme builder- Returns:
- this color scheme builder to enable method chaining for a more fluent API
-
errors
public CommandLine.Help.ColorScheme.Builder errors(CommandLine.Help.Ansi.IStyle... styles)
Adds the specified styles to the registered styles for errors in this color scheme builder and returns this builder.- Parameters:
styles
- the styles to add to the registered styles for errors in this color scheme builder- Returns:
- this color scheme builder to enable method chaining for a more fluent API
- Since:
- 4.3
-
stackTraces
public CommandLine.Help.ColorScheme.Builder stackTraces(CommandLine.Help.Ansi.IStyle... styles)
Adds the specified styles to the registered styles for stack traces in this color scheme builder and returns this builder.- Parameters:
styles
- the styles to add to the registered styles for stack traces in this color scheme builder- Returns:
- this color scheme builder to enable method chaining for a more fluent API
- Since:
- 4.3
-
applySystemProperties
public CommandLine.Help.ColorScheme.Builder applySystemProperties()
Replaces colors and styles in this scheme builder with ones specified in system properties, and returns this builder. Supported property names:picocli.color.commands
picocli.color.options
picocli.color.parameters
picocli.color.optionParams
picocli.color.errors
picocli.color.stackTraces
Property values can be anything that
CommandLine.Help.Ansi.Style.parse(String)
can handle.- Returns:
- this ColorScheme builder
-
replace
private void replace(java.util.List<CommandLine.Help.Ansi.IStyle> styles, java.lang.String property)
-
addAll
private CommandLine.Help.ColorScheme.Builder addAll(java.util.List<CommandLine.Help.Ansi.IStyle> styles, CommandLine.Help.Ansi.IStyle... add)
-
build
public CommandLine.Help.ColorScheme build()
Creates and returns a newColorScheme
with the values configured on this builder.
-
-