Enum CommandLine.Help.Ansi
java.lang.Object
java.lang.Enum<CommandLine.Help.Ansi>
org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi
- All Implemented Interfaces:
Serializable
,Comparable<CommandLine.Help.Ansi>
,java.lang.constant.Constable
- Enclosing class:
- CommandLine.Help
Provides methods and inner classes to support using ANSI escape codes in usage help messages.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Defines the interface for an ANSI escape sequence.(package private) static class
Defines a palette map of 216 colors: 6 * 6 * 6 cube (216 colors): 16 + 36 * r + 6 * g + b (0 <= r, g, b <= 5).static enum
A set of pre-defined ANSI escape code styles and colors, and a set of convenience methods for parsing text with embedded markup style names, as well as convenience methods for converting styles to strings with embedded escape codes.private static class
class
Encapsulates rich text with styles and colors.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionOnly emit ANSI escape codes if the platform supports it and system property"picocli.ansi"
is not set to any value other than"true"
(case insensitive).Forced OFF: never emit ANSI escape code regardless of the platform.Forced ON: always emit ANSI escape code regardless of the platform. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static CommandLine.Help.Ansi.Text
(package private) static final boolean
(package private) static final boolean
(package private) static final boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
apply
(String plainText, List<CommandLine.Help.Ansi.IStyle> styles) Returns a new Text object where all the specified styles are applied to the full length of the specified plain text.(package private) static final boolean
calcTTY()
boolean
enabled()
Returnstrue
if ANSI escape codes should be emitted,false
otherwise.private static <T> T[]
reverse
(T[] all) static CommandLine.Help.Ansi
Returns the enum constant of this type with the specified name.static CommandLine.Help.Ansi[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
AUTO
Only emit ANSI escape codes if the platform supports it and system property"picocli.ansi"
is not set to any value other than"true"
(case insensitive). -
ON
Forced ON: always emit ANSI escape code regardless of the platform. -
OFF
Forced OFF: never emit ANSI escape code regardless of the platform.
-
-
Field Details
-
EMPTY_TEXT
-
isWindows
static final boolean isWindows -
isXterm
static final boolean isXterm -
ISATTY
static final boolean ISATTY
-
-
Constructor Details
-
Ansi
private Ansi()
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
calcTTY
static final boolean calcTTY() -
ansiPossible
private static boolean ansiPossible() -
enabled
public boolean enabled()Returnstrue
if ANSI escape codes should be emitted,false
otherwise.- Returns:
- ON:
true
, OFF:false
, AUTO: if system property"picocli.ansi"
is defined then return its boolean value, otherwise return whether the platform supports ANSI escape codes
-
apply
public CommandLine.Help.Ansi.Text apply(String plainText, List<CommandLine.Help.Ansi.IStyle> styles) Returns a new Text object where all the specified styles are applied to the full length of the specified plain text.- Parameters:
plainText
- the string to apply all styles to. Must not contain markup!styles
- the styles to apply to the full plain text- Returns:
- a new Text object
-
reverse
private static <T> T[] reverse(T[] all)
-