type

Console

src @Js
const class Console : Obj

Console provides utilities to interact with the terminal console. For Java this API is designed to use jline if installed. In browser JavaScript environments this APIs uses the JS debugging window.

methods

clear

Clear the console of all text if supported

cur

Get the default console for the virtual machine

debug

Print a message to the console at the debug level

err

Print a message to the console at the error level

group

Enter an indented group level in the console.

groupEnd

Exit an indented, collapsable group level

height

Number of lines that fit vertically in console or null if unknown

info

Print a message to the console at the informational level

prompt

Prompt the user to enter a string from standard input.

promptPassword

Prompt the user to enter a password string from standard input with echo disabled.

table

Print tabular data to the console

warn

Print a message to the console at the warning level

width

Number of chars that fit horizontally in console or null if unknown

Slot Details

clear

src This clear()

Clear the console of all text if supported

cur

src static Console cur()

Get the default console for the virtual machine

debug

src This debug(Obj? msg)

Print a message to the console at the debug level

err

src This err(Obj? msg)

Print a message to the console at the error level

group

src This group(Obj? msg, Bool collapsed := false)

Enter an indented group level in the console. The JS debug window can specify the group to default in a collapsed state (this flag is ignored in a standard terminal).

groupEnd

src This groupEnd()

Exit an indented, collapsable group level

height

src Int? height()

Number of lines that fit vertically in console or null if unknown

info

src This info(Obj? msg)

Print a message to the console at the informational level

prompt

src Str? prompt(Str msg := "")

Prompt the user to enter a string from standard input. Return null if end of stream has been reached.

promptPassword

src Str? promptPassword(Str msg := "")

Prompt the user to enter a password string from standard input with echo disabled. Return null if end of stream has been reached.

table

src This table(Obj? obj)

Print tabular data to the console:

  • List of list is two dimensional data where first row is header names
  • List of items with an each method will create column per key
  • List of items without each will map to a column of "val"
  • Anything else will be table of one cell table

warn

src This warn(Obj? msg)

Print a message to the console at the warning level

width

src Int? width()

Number of chars that fit horizontally in console or null if unknown