RingoJS

Module ringo/term

A module for printing ANSI terminal escape sequences. This module provides a number of useful color and style constants, and a replacement for the print function optimized for styled output.

Example

const term = require('ringo/term')
term.writeln(YELLOW, "foo", MAGENTA, "bar");
// foo bar
term.writeln(YELLOW, ONBLUE, "IKEA");
// IKEA
term.writeln(RED, BOLD, INVERSE, "Red Alert!");
// Red Alert!

See

http://en.wikipedia.org/wiki/ANSI_escape_code



















TermWriter ()

Creates a terminal writer that writes to the Java console.


TermWriter.prototype. isEnabled ()

Returns true if ANSI terminal colors are enabled.

Returns

Boolean

true if ANSI is enabled.


TermWriter.prototype. setEnabled (flag)

Enable or disable ANSI terminal colors for this writer.

Parameters

Boolean flag

true to enable ANSI colors.


TermWriter.prototype. write (args...)

Write the arguments to the stream, applying ANSI terminal colors if enabled is true.

Parameters

*... args...

variable number of arguments to write


TermWriter.prototype. writeln (args...)

Write the arguments to the stream followed by a newline character, applying ANSI terminal colors if enabled is true.

Parameters

*... args...

variable number of arguments to write





write (args...)

Write the arguments to system.stdout, applying ANSI terminal colors if support has been detected.

Parameters

*... args...

variable number of arguments to write


writeln (args...)

Write the arguments to system.stdout followed by a newline character, applying ANSI terminal colors if support has been detected.

Parameters

*... args...

variable number of arguments to write