class Cli

Class Cli

Constants

NORMAL

FG_BLACK

FG_RED

FG_GREEN

FG_BROWN

FG_BLUE

FG_CYAN

FG_WHITE

FG_DEFAULT

FG_DARK_GRAY

FG_LIGHT_RED

FG_LIGHT_GREEN

FG_LIGHT_YELLOW

FG_LIGHT_BLUE

FG_LIGHT_MAGENTA

FG_LIGHT_CYAN

FG_WHITE_W

BG_BLACK

BG_RED

BG_GREEN

BG_BROWN

BG_BLUE

BG_CYAN

BG_WHITE

BG_DEFAULT

BG_DARK_GRAY

BG_LIGHT_RED

BG_LIGHT_GREEN

BG_LIGHT_YELLOW

BG_LIGHT_BLUE

BG_LIGHT_MAGENTA

BG_LIGHT_CYAN

BG_WHITE_W

BOLD

FUZZY

ITALIC

UNDERSCORE

BLINK

REVERSE

CONCEALED

COLOR_TAG

Regex to match tags

STYLES

some styles

Methods

static string
color($text, string|int|array $style = null)

No description

static 
renderColor($text)

No description

static string
clearColor(string $text)

No description

static string
read(mixed $message = null, bool $nl = false)

No description

static 
write($message, bool $nl = true, bool $quit = false)

write message to console

static 
stdout(string $message, bool $nl = true, bool|int $quit = false)

Logs data to stdout

static 
stderr(string $message, bool $nl = true, bool|int $quit = -200)

Logs data to stderr

static boolean
isSupportColor()

Returns true if STDOUT supports colorization.

static array
parseArgv(array $noValues = [], bool $mergeOpts = false)

Parses $GLOBALS['argv'] for parameters and assigns them to an array.

Details

at line 116
static string color($text, string|int|array $style = null)

Parameters

$text
string|int|array $style

Return Value

string

at line 144
static renderColor($text)

Parameters

$text

at line 176
static string clearColor(string $text)

Parameters

string $text

Return Value

string

at line 191
static string read(mixed $message = null, bool $nl = false)

Parameters

mixed $message
bool $nl

Return Value

string

at line 206
static write($message, bool $nl = true, bool $quit = false)

write message to console

Parameters

$message
bool $nl
bool $quit

at line 221
static stdout(string $message, bool $nl = true, bool|int $quit = false)

Logs data to stdout

Parameters

string $message
bool $nl
bool|int $quit

at line 238
static stderr(string $message, bool $nl = true, bool|int $quit = -200)

Logs data to stderr

Parameters

string $message
bool $nl
bool|int $quit

at line 255
static boolean isSupportColor()

Returns true if STDOUT supports colorization.

This code has been copied and adapted from \Symfony\Component\Console\Output\OutputStream.

Return Value

boolean

at line 274
static array parseArgv(array $noValues = [], bool $mergeOpts = false)

Parses $GLOBALS['argv'] for parameters and assigns them to an array.

Supports: -e -e --long-param --long-param= --long-param

Parameters

array $noValues List of parameters without values
bool $mergeOpts

Return Value

array