Class \Prado\Shell\TShellWriter
Similar to the THtmlWriter, the TShellWriter writes and formats text with color, and processes other commands to the terminal to another ITextWriter.
Class hierarchy
Author: Brad Anderson <belisoful@icloud.com>Since: 4.2.0
public
|
|
public
|
clearLine() : mixed
Clears the line, the cursor is currently on by sending ANSI control code EL with argument 2 to the terminal.
Cursor position will not be changed. |
public
|
clearLineAfterCursor() : mixed
Clears text from cursor position to the end of the line by sending ANSI control code EL with argument 0 to the terminal.
Cursor position will not be changed. |
public
|
clearLineBeforeCursor() : mixed
Clears text from cursor position to the beginning of the line by sending ANSI control code EL with argument 1 to the terminal.
Cursor position will not be changed. |
public
|
clearScreen() : mixed
Clears entire screen content by sending ANSI control code ED with argument 2 to the terminal.
Cursor position will not be changed. Note: ANSI.SYS implementation used in windows will reset cursor position to upper left corner of the screen. |
public
|
clearScreenAfterCursor() : mixed
Clears text from cursor to the end of the screen by sending ANSI control code ED with argument 0 to the terminal.
Cursor position will not be changed. |
public
|
clearScreenBeforeCursor() : mixed
Clears text from cursor to the beginning of the screen by sending ANSI control code ED with argument 1 to the terminal.
Cursor position will not be changed. |
public
|
flush() : string
Flushes the rendering result.
This will invoke the underlying writer's flush method. |
public
|
|
public
|
|
public
static
|
getScreenSize([bool $refresh = false ]) : array<string|int, mixed>|bool
Returns terminal screen size.
Usage:
|
public
|
|
public
|
hideCursor() : mixed
Hides the cursor by sending ANSI DECTCEM code ?25l to the terminal.
Use showCursor to bring it back. Do not forget to show cursor when your application exits. Cursor might stay hidden in terminal after exit. |
public
|
moveCursorBackward([int $steps = 1 ]) : mixed
Moves the terminal cursor backward by sending ANSI control code CUB to the terminal.
If the cursor is already at the edge of the screen, this has no effect. |
public
|
moveCursorDown([int $rows = 1 ]) : mixed
Moves the terminal cursor down by sending ANSI control code CUD to the terminal.
If the cursor is already at the edge of the screen, this has no effect. |
public
|
moveCursorForward([int $steps = 1 ]) : mixed
Moves the terminal cursor forward by sending ANSI control code CUF to the terminal.
If the cursor is already at the edge of the screen, this has no effect. |
public
|
moveCursorNextLine([int $lines = 1 ]) : mixed
Moves the terminal cursor to the beginning of the next line by sending ANSI control code CNL to the terminal.
|
public
|
moveCursorPrevLine([int $lines = 1 ]) : mixed
Moves the terminal cursor to the beginning of the previous line by sending ANSI control code CPL to the terminal.
|
public
|
moveCursorTo(int $column[, null|int $row = null ]) : mixed
Moves the cursor to an absolute position given as column and row by sending ANSI control code CUP or CHA to the terminal.
|
public
|
moveCursorUp([int $rows = 1 ]) : mixed
Moves the terminal cursor up by sending ANSI control code CUU to the terminal.
If the cursor is already at the edge of the screen, this has no effect. |
public
|
|
public
|
restoreCursorPosition() : mixed
Restores the cursor position saved with {@see saveCursorPosition} by sending ANSI control code RCP to the terminal.
|
public
|
saveCursorPosition() : mixed
Saves the current cursor position by sending ANSI control code SCP to the terminal.
Position can then be restored with restoreCursorPosition. |
public
|
scrollDown([int $lines = 1 ]) : mixed
Scrolls whole page down by sending ANSI control code SD to the terminal.
New lines are added at the top. This is not supported by ANSI.SYS used in windows. |
public
|
scrollUp([int $lines = 1 ]) : mixed
Scrolls whole page up by sending ANSI control code SU to the terminal.
New lines are added at the bottom. This is not supported by ANSI.SYS used in windows. |
public
|
|
public
|
|
public
|
showCursor() : mixed
Will show a cursor again when it has been hidden by {@see hideCursor} by sending ANSI DECTCEM code ?25h to the terminal.
|
public
|
tableWidget(array<string|int, mixed> $table) : mixed
renders a table widget.
|
public
|
|
public
|
wrapText(string $text[, int $indent = 0 ][, bool $refresh = false ]) : string
Word wrap text with indentation to fit the screen size.
If screen size could not be detected, or the indentation is greater than the screen size, the text will not be wrapped. The first line will not be indented, so
|
public
|
|
public
|
|
public
|
writeLine([string $str = '' ][, null|mixed $attr = null ]) : mixed
Renders a string and appends a newline to it.
|
protected
|
public
mixed
|
BG_BLACK
|
40
|
public
mixed
|
BG_BLUE
|
44
|
public
mixed
|
BG_CYAN
|
46
|
public
mixed
|
BG_DARK_GRAY
|
100
|
public
mixed
|
BG_DEFAULT
|
49
|
public
mixed
|
BG_GREEN
|
42
|
public
mixed
|
BG_LIGHT_BLUE
|
104
|
public
mixed
|
BG_LIGHT_CYAN
|
106
|
public
mixed
|
BG_LIGHT_GRAY
|
47
|
public
mixed
|
BG_LIGHT_GREEN
|
102
|
public
mixed
|
BG_LIGHT_MAGENTA
|
105
|
public
mixed
|
BG_LIGHT_RED
|
101
|
public
mixed
|
BG_LIGHT_YELLOW
|
103
|
public
mixed
|
BG_MAGENTA
|
45
|
public
mixed
|
BG_RED
|
41
|
public
mixed
|
BG_WHITE
|
107
|
public
mixed
|
BG_YELLOW
|
43
|
public
mixed
|
BLACK
|
30
|
public
mixed
|
BLINK
|
5
|
public
mixed
|
BLUE
|
34
|
public
mixed
|
BOLD
|
1
|
public
mixed
|
CONCEALED
|
8
|
public
mixed
|
CROSSED
|
9
|
public
mixed
|
CYAN
|
36
|
public
mixed
|
DARK
|
2
|
public
mixed
|
DARK_GRAY
|
90
|
public
mixed
|
DEFAULT
|
39
|
public
mixed
|
ENCIRCLED
|
52
|
public
mixed
|
FRAMED
|
51
|
public
mixed
|
GREEN
|
32
|
public
mixed
|
ITALIC
|
3
|
public
mixed
|
LIGHT_BLUE
|
94
|
public
mixed
|
LIGHT_CYAN
|
96
|
public
mixed
|
LIGHT_GRAY
|
37
|
public
mixed
|
LIGHT_GREEN
|
92
|
public
mixed
|
LIGHT_MAGENTA
|
95
|
public
mixed
|
LIGHT_RED
|
91
|
public
mixed
|
LIGHT_YELLOW
|
93
|
public
mixed
|
MAGENTA
|
35
|
public
mixed
|
OVERLINED
|
53
|
public
mixed
|
RED
|
31
|
public
mixed
|
REVERSE
|
7
|
public
mixed
|
UNDERLINE
|
4
|
public
mixed
|
WHITE
|
97
|
public
mixed
|
YELLOW
|
33
|
\Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |