Package io.github.qishr.cascara.common.util
Class Builder
java.lang.Object
io.github.qishr.cascara.common.util.CommandLine.Help.ColorScheme.Builder
Enclosing Class:
io.github.qishr.cascara.common.util.CommandLine.Help.ColorScheme
public static class Builder
Builder class to create ColorScheme instances.
Constructor Summary
| Constructor | Description |
|---|---|
| Builder() | Constructs an empty color scheme builder with Ansi.AUTO. |
| Builder(Ansi ansi) | Constructs an empty color scheme builder with the specified Ansi value. |
| Builder(ColorScheme existing) | Constructs a color scheme builder with all attributes copied from the specified color scheme. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
| public Ansi | ansi() | Returns the Ansi setting of this color scheme builder. |
| public Builder | ansi(Ansi ansi) | Set the Ansi setting of this color scheme builder. |
| public List<IStyle> | commandStyles() | Returns the registered styles for commands in this color scheme builder. |
| public List<IStyle> | optionStyles() | Returns the registered styles for options in this color scheme builder. |
| public List<IStyle> | parameterStyles() | Returns the registered styles for positional parameters in this color scheme builder. |
| public List<IStyle> | optionParamStyles() | Returns the registered styles for option parameters in this color scheme builder. |
| public List<IStyle> | errorStyles() | Returns the registered styles for errors in this color scheme builder. |
| public List<IStyle> | stackTraceStyles() | Returns the registered styles for stack traces in this color scheme builder. |
| public Map<String, IStyle> | customMarkupMap() | Returns the custom mapping from markup names (the names of the Style enum constants, like bold, italic, fg_blue, bg_green, etc) to IStyle objects in this color scheme. |
| public Builder | customMarkupMap(Map<String, IStyle> newValue) | Sets the custom mapping from markup names (the names of the Style enum constants, like bold, italic, fg_blue, bg_green, etc) to IStyle objects in this color scheme. |
| public Builder | commands(IStyle[] styles) | Adds the specified styles to the registered styles for commands in this color scheme builder and returns this builder. |
| public Builder | options(IStyle[] styles) | Adds the specified styles to the registered styles for options in this color scheme and returns this color scheme. |
| public Builder | parameters(IStyle[] styles) | Adds the specified styles to the registered styles for positional parameters in this color scheme builder and returns this builder. |
| public Builder | optionParams(IStyle[] styles) | Adds the specified styles to the registered styles for option parameters in this color scheme builder and returns this builder. |
| public Builder | errors(IStyle[] styles) | Adds the specified styles to the registered styles for errors in this color scheme builder and returns this builder. |
| public Builder | stackTraces(IStyle[] styles) | Adds the specified styles to the registered styles for stack traces in this color scheme builder and returns this builder. |
| public Builder | applySystemProperties() | Replaces colors and styles in this scheme builder with ones specified in system properties, and returns this builder. |
| public ColorScheme | build() | Creates and returns a new ColorScheme with the values configured on this builder. |
Method Details
ansi
public Ansi ansi()
Returns the Ansi setting of this color scheme builder.
ansi
public Builder ansi(Ansi ansi)
Set the Ansi setting of this color scheme builder.
commandStyles
public List<IStyle> commandStyles()
Returns the registered styles for commands in this color scheme builder.
optionStyles
public List<IStyle> optionStyles()
Returns the registered styles for options in this color scheme builder.
parameterStyles
public List<IStyle> parameterStyles()
Returns the registered styles for positional parameters in this color scheme builder.
optionParamStyles
public List<IStyle> optionParamStyles()
Returns the registered styles for option parameters in this color scheme builder.
errorStyles
public List<IStyle> errorStyles()
Returns the registered styles for errors in this color scheme builder.
Since:
4.3
stackTraceStyles
public List<IStyle> stackTraceStyles()
Returns the registered styles for stack traces in this color scheme builder.
Since:
4.3
customMarkupMap
public Map<String, IStyle> customMarkupMap()
Returns the custom mapping from markup names (the names of the Style enum constants, like bold, italic, fg_blue, bg_green, etc) to IStyle objects in this color scheme.By default this returns null, unless a custom map was configured.
Since:
4.2
customMarkupMap
public Builder customMarkupMap(Map<String, IStyle> newValue)
Sets the custom mapping from markup names (the names of the Style enum constants, like bold, italic, fg_blue, bg_green, etc) to 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 Builder commands(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 Builder options(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 Builder parameters(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 Builder optionParams(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 Builder errors(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 Builder stackTraces(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 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 Help.Ansi.Style#parse(String) can handle.
Returns:
this ColorScheme builder
build
public ColorScheme build()
Creates and returns a new ColorScheme with the values configured on this builder.