Console
in package
Contains tools for CLI I/O
Table of Contents
- ClearLine() : void
- Removes text from the last line
- ClearWindow() : void
- Clears all output in window
- HideCursor() : void
- Hides the cursor
- InterruptRead() : void
- Interrupts already called and still not finished or will be called Console::ReadLine() and Console::ReadKey(). Can be used in asynchronous tasks to stop reading
- MoveCursorDown() : void
- Moves the cursor down
- MoveCursorLeft() : void
- Moves the cursor left
- MoveCursorRight() : void
- Moves the cursor right
- MoveCursorToNextLine() : void
- Moves the cursor to next line
- MoveCursorToPreviousLine() : void
- Moves the cursor to previous line
- MoveCursorUp() : void
- Moves the cursor up
- ReadKey() : string
- Waits when user press keyboard key and returns character or key name
- ReadLine() : string
- Reads a line from input stream after user pressed ENTER
- ShowCursor() : void
- Shows the cursor
- Write() : void
- Writes data to stream output
- WriteLine() : void
- Writes data to stream output and sets pointer to new line
Methods
ClearLine()
Removes text from the last line
public
static ClearLine([string $text = "" ]) : void
Parameters
- $text : string = ""
-
Replace whole text on current line to new text
Return values
void —ClearWindow()
Clears all output in window
public
static ClearWindow([string $replacement = "" ]) : void
Parameters
- $replacement : string = ""
-
New screen's content
Return values
void —HideCursor()
Hides the cursor
public
static HideCursor() : void
Return values
void —InterruptRead()
Interrupts already called and still not finished or will be called Console::ReadLine() and Console::ReadKey(). Can be used in asynchronous tasks to stop reading
public
static InterruptRead() : void
Return values
void —MoveCursorDown()
Moves the cursor down
public
static MoveCursorDown([int $rows = 1 ]) : void
Parameters
- $rows : int = 1
-
Count of rows to down
Return values
void —MoveCursorLeft()
Moves the cursor left
public
static MoveCursorLeft([int $columns = 1 ]) : void
Parameters
- $columns : int = 1
-
Count of columns to move
Return values
void —MoveCursorRight()
Moves the cursor right
public
static MoveCursorRight([int $columns = 1 ]) : void
Parameters
- $columns : int = 1
-
Count of columns to move
Return values
void —MoveCursorToNextLine()
Moves the cursor to next line
public
static MoveCursorToNextLine([int $lines = 1 ]) : void
Parameters
- $lines : int = 1
Return values
void —MoveCursorToPreviousLine()
Moves the cursor to previous line
public
static MoveCursorToPreviousLine([int $lines = 1 ]) : void
Parameters
- $lines : int = 1
Return values
void —MoveCursorUp()
Moves the cursor up
public
static MoveCursorUp([int $rows = 1 ]) : void
Parameters
- $rows : int = 1
-
Count of rows to up
Return values
void —ReadKey()
Waits when user press keyboard key and returns character or key name
public
static ReadKey([bool $interruptible = true ]) : string
Parameters
- $interruptible : bool = true
-
Is method can be interrupted by Console::InterruptRead()
Tags
Return values
string —Pressed character or key name
ReadLine()
Reads a line from input stream after user pressed ENTER
public
static ReadLine([bool $hideInput = false ][, bool $interruptible = true ]) : string
Parameters
- $hideInput : bool = false
-
Hides characters which user is typing
- $interruptible : bool = true
-
Is method can be interrupted by Console::InterruptRead()
Tags
Return values
string —Data from input stream
ShowCursor()
Shows the cursor
public
static ShowCursor() : void
Return values
void —Write()
Writes data to stream output
public
static Write(string $text[, ForegroundColors $foregroundColor = ForegroundColors::AUTO ][, BackgroundColors $backgroundColor = BackgroundColors::AUTO ]) : void
Parameters
- $text : string
-
Input text
- $foregroundColor : ForegroundColors = ForegroundColors::AUTO
-
Text color
- $backgroundColor : BackgroundColors = BackgroundColors::AUTO
-
Background color
Return values
void —WriteLine()
Writes data to stream output and sets pointer to new line
public
static WriteLine(string $text[, ForegroundColors $foregroundColor = ForegroundColors::AUTO ][, BackgroundColors $backgroundColor = BackgroundColors::AUTO ]) : void
Parameters
- $text : string
-
Input text
- $foregroundColor : ForegroundColors = ForegroundColors::AUTO
-
Text color
- $backgroundColor : BackgroundColors = BackgroundColors::AUTO
-
Background color