Class MessageUtils

java.lang.Object
org.apache.maven.jline.MessageUtils

public class MessageUtils extends Object
Colorized 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 Details

    • MessageUtils

      public MessageUtils()
  • Method Details

    • 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()
      Returns true if systemInstall() 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 -1 if unknown. Taken from the COLUMNS environment variable if set, otherwise (on a detected non-Windows terminal) from stty size. Computed once.
    • builder

      public static MessageBuilder builder()
    • stripAnsiCodes

      public static String stripAnsiCodes(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