Package org.apache.maven.jline
Class MessageUtils
- java.lang.Object
-
- org.apache.maven.jline.MessageUtils
-
public class MessageUtils extends java.lang.ObjectColorized message support. Maven only needs ANSI colors in its log output, so there is no terminal library here: styles are emitted as plain SGR escape sequences, and only when color is enabled.
-
-
Constructor Summary
Constructors Constructor Description MessageUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.maven.api.services.MessageBuilderbuilder()static intgetTerminalWidth()Returns the terminal width in columns, or-1if unknown.static booleanisColorEnabled()static booleanisTty()ReturnstrueifsystemInstall()detected an ANSI capable terminal on standard output.static voidsetColorEnabled(boolean enabled)static java.lang.StringstripAnsiCodes(java.lang.String msg)Remove any ANSI code from a message (colors or other escape sequences).static voidsystemInstall()Detects whether standard output is an ANSI capable terminal and enables color accordingly.
-
-
-
Method Detail
-
systemInstall
public static void systemInstall()
Detects whether standard output is an ANSI capable terminal and enables color accordingly. Only the CLI calls this; embedded use never does, so "auto" color stays off there.
-
isTty
public static boolean isTty()
ReturnstrueifsystemInstall()detected an ANSI capable terminal on standard output.
-
setColorEnabled
public static void setColorEnabled(boolean enabled)
-
isColorEnabled
public static boolean isColorEnabled()
-
getTerminalWidth
public static int getTerminalWidth()
Returns the terminal width in columns, or-1if unknown. Taken from theCOLUMNSenvironment variable if set, otherwise (on a detected non-Windows terminal) fromstty size. Computed once.
-
builder
public static org.apache.maven.api.services.MessageBuilder builder()
-
stripAnsiCodes
public static java.lang.String stripAnsiCodes(java.lang.String msg)
Remove any ANSI code from a message (colors or other escape sequences).- Parameters:
msg- message eventually containing ANSI codes- Returns:
- the message with ANSI codes removed
-
-