Class AnsiPrintStream

java.lang.Object
nz.org.riskscape.cli.AnsiPrintStream
All Implemented Interfaces:
AnsiHelper

public final class AnsiPrintStream extends Object implements AnsiHelper

A more convenient print stream API to use for printing things out to the console, supporting ANSI styling if the underlying terminal supports it and fluid use (e.g. it returns itself)

  • Constructor Details

    • AnsiPrintStream

      public AnsiPrintStream(Terminal terminal)

      Create a print stream wrapping the given terminal's stdout

    • AnsiPrintStream

      public AnsiPrintStream(CommandLine.Help.Ansi ansi, PrintStream out)
  • Method Details

    • print

      public AnsiPrintStream print(Object object)

      Print the given object's toString representation raw (no ansi escaping) to the underlying stream.

    • println

      public AnsiPrintStream println(Object object)

      Print the given object's toString representation raw (no ansi escaping) to the underlying stream. A new line is appended.

    • printStyles

      public AnsiPrintStream printStyles(String plainText, CommandLine.Help.Ansi.IStyle... styles)

      Print the given text to the underlying stream, wrapping it in the given styles (if supported)

    • printlnStyles

      public AnsiPrintStream printlnStyles(String plainText, CommandLine.Help.Ansi.Style... styles)

      Print the given text to the underlying stream, wrapping it in the given styles (if supported). A new line is appended.

    • printMarkup

      public AnsiPrintStream printMarkup(String markupText)

      Print the given text to the underlying stream, parsing picocli markup and converting it to have the correct escape codes

    • printlnMarkup

      public AnsiPrintStream printlnMarkup(String markupText)

      Print the given text to the underlying stream, parsing picocli markup and converting it to have the correct escape codes. A new line is appended.

    • println

      public AnsiPrintStream println()

      Print a new line to the underlying stream

    • getAnsi

      public CommandLine.Help.Ansi getAnsi()
      Specified by:
      getAnsi in interface AnsiHelper
      Returns:
      the ansi object we are wrapping