picocli

## Enum CommandLine.Help.Ansi

- java.lang.Object
- - java.lang.Enum<CommandLine.Help.Ansi>
  - - picocli.CommandLine.Help.Ansi

All Implemented Interfaces:
  java.io.Serializable, java.lang.Comparable<CommandLine.Help.Ansi>

Enclosing class:
  CommandLine.Help

    public static enum CommandLine.Help.Ansi
    extends java.lang.Enum<CommandLine.Help.Ansi>

Provides methods and inner classes to support using ANSI escape codes in usage help messages.

### Nested Class Summary

Nested Classes
`static interface` `CommandLine.Help.Ansi.IStyle` Defines the interface for an ANSI escape sequence.
`static class` `CommandLine.Help.Ansi.Style` 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.
`class` `CommandLine.Help.Ansi.Text` Encapsulates rich text with styles and colors.

### Enum Constant Summary

Enum Constants
Enum Constant and Description
`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).
`OFF` Forced OFF: never emit ANSI escape code regardless of the platform.
`ON` Forced ON: always emit ANSI escape code regardless of the platform.

### Method Summary

Methods
`CommandLine.Help.Ansi.Text` `apply(java.lang.String plainText, java.util.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.
`boolean` `enabled()` Returns `true` if ANSI escape codes should be emitted, `false` otherwise.
`static CommandLine.Help.Ansi` `valueOf(java.lang.String name)` 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.

### Methods inherited from class java.lang.Enum

`clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

### Enum Constant Detail

#### AUTO

    public static final CommandLine.Help.Ansi 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

    public static final CommandLine.Help.Ansi ON

Forced ON: always emit ANSI escape code regardless of the platform.

#### OFF

    public static final CommandLine.Help.Ansi OFF

Forced OFF: never emit ANSI escape code regardless of the platform.

### Method Detail

#### values

    public static CommandLine.Help.Ansi[] values()

Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

    for (CommandLine.Help.Ansi c : CommandLine.Help.Ansi.values())
        System.out.println(c);

Returns:
  an array containing the constants of this enum type, in the order they are declared

#### valueOf

    public static CommandLine.Help.Ansi valueOf(java.lang.String name)

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:
  `java.lang.IllegalArgumentException` - if this enum type has no constant with the specified name
  `java.lang.NullPointerException` - if the argument is null

#### enabled

    public boolean enabled()

Returns `true` 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(java.lang.String plainText,
                                   java.util.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