Skip to content

Latest commit

 

History

History
642 lines (405 loc) · 8.15 KB

DOCS.md

File metadata and controls

642 lines (405 loc) · 8.15 KB

Documentation

Class: \CLI\Cursor

<?php
namespace CLI;

class Cursor {
	/**
	 * Pointer to the stream where the data is sent
	 * @var resource
	 */
	public static $stream = STDERR;
}

Method: Cursor::up

function up([ $count = 1])

Move the cursor up by count

Parameters:

  • int $count

Method: Cursor::down

function down([ $count = 1])

Move the cursor down by count

Parameters:

  • int $count

Method: Cursor::forward

function forward([ $count = 1])

Move the cursor right by count

Parameters:

  • int $count

Method: Cursor::back

function back([ $count = 1])

Move the cursor left by count

Parameters:

  • int $count

Method: Cursor::rowcol

function rowcol([ $row = 1 [, $col = 1]])

Move the cursor to a specific row and column

Parameters:

  • int $row
  • int $col

Method: Cursor::savepos

function savepos()

Save the current cursor position


Method: Cursor::save

function save()

Save the current cursor position and attributes


Method: Cursor::unsave

function unsave()

Delete the currently saved cursor data


Method: Cursor::restore

function restore()

Restore the previously saved cursor data


Method: Cursor::hide

function hide()

Hides the cursor


Method: Cursor::show

function show()

Shows the cursor


Method: Cursor::wrap

function wrap([ $wrap = true])

Enable/Disable Auto-Wrap

Parameters:

  • bool $wrap

Class: \CLI\Erase

<?php
namespace CLI;

class Erase {
	/**
	 * Pointer to the stream where the data is sent
	 * @var resource
	 */
	public static $stream = STDERR;
}

Method: Erase::eol

function eol()

Erase to the end of line


Method: Erase::sol

function sol()

Erase to the start of line


Method: Erase::line

function line([ $row = null])

Erase entire line

Parameters:

  • int | null $row - from a specific row

Method: Erase::down

function down([ $row = null])

Erases everything below the cursor

Parameters:

  • int | null $row - from a specific row

Method: Erase::up

function up([ $row = null])

Erases everything above the cursor

Parameters:

  • int | null $row - from a specific row

Method: Erase::screen

function screen()

Erases the entire screen

Class: \CLI\Graphics

Undocumented Method: Graphics::line($x1, $y1, $x2, $y2 [, $chars = array('#')])


Undocumented Method: Graphics::box($x1, $y1, $x2, $y2 [, $frame = array("-", "|", "-", "|", "x", "x", "x", "x")])

Class: \CLI\Misc

<?php
namespace CLI;

class Misc {
	/**
	 * Pointer to the stream where the data is sent
	 * @var resource
	 */
	public static $stream = STDERR;
}

Method: Misc::cols

function cols([ $cache = true])

The col size of the current terminal as returned by tput

Parameters:

  • bool $cache - Whether to cache the response

Returns:

  • int

Method: Misc::rows

function rows([ $cache = true])

The row size of the current terminal as returned by tput

Parameters:

  • bool $cache - Whether to cache the response

Returns:

  • int

Method: Misc::bell

function bell([ $count = 1])

Triggers a terminal bell

Parameters:

  • int $count

Method: Misc::savestate

function savestate()

Save the current state of the terminal via tput


Method: Misc::restorestate

function restorestate()

Restore the current state of the terminal via tput

Class: \CLI\Output

<?php
namespace CLI;

class Output {
	/**
	 * Pointer to the stream where the data is sent
	 * @var resource
	 */
	public static $stream = STDOUT;
}

Method: Output::string

function string($str [, $row = null [, $col = null]])

Output a string

Parameters:

  • string $str - String to output
  • false | int $row - The optional row to output to
  • false | int $col - The optional column to output to

Method: Output::line

function line($str [, $col = null [, $erase = true]])

Output a line, erasing the line first

Parameters:

  • string $str - String to output
  • null | int $col - The column to draw the current line
  • bool $erase - Clear the line before drawing the passed string

Class: \CLI\Screen

<?php
namespace CLI;

class Screen {
	/**
	 * Pointer to the stream where the data is sent
	 * @var resource
	 */
	public static $stream = STDERR;
}

Method: Screen::alternate

function alternate([ $erase = true])

Switch to the alternate screen buffer, optionally clearing it


Method: Screen::main

function main()

Switch to the main screen buffer

Class: \CLI\StatusGUI

<?php
namespace CLI;

class StatusGUI {
	/**
	 * Pointer to the stream where the data is sent
	 * @var resource
	 */
	public static $stream = STDERR;
	public static $altstream = STDOUT;
}

Method: StatusGUI::statusbar

function statusbar($str [, $height = null [, $last_line_to_opposing_stream = true]])

Render a statusbar stack

Parameters:

  • string $str - The status to add
  • null | int $height - The height of the status menu to render
  • bool $last_line_to_opposing_stream - Send the last line of the status to the oposite stream (STDERR/STDOUT)

Method: StatusGUI::progressbar

function progressbar($title, $numerator, $denominator, $line [, $time_id = null [, $color = 'cyan']])

Draw a Progress Bar

Parameters:

  • string $title
  • int $numerator
  • int $denominator
  • int $line - Which row of the terminal to render
  • int | null $time_id
  • string $color

Method: StatusGUI::histogram

function histogram($title, $numerator, $denominator, $line, $hist_id [, $color = 'normal' [, $full_color = 'red']])

Draw a Histogram

Parameters:

  • string $title
  • int $numerator
  • int $denominator
  • int $line
  • int $hist_id
  • string $color
  • string $full_color

Class: \CLI\Style

Class Style

Magic Method: Style::bold

function bold($text, $args) : string

Magic Method: Style::black

function black($text, $args) : string

Magic Method: Style::blue

function blue($text, $args) : string

Magic Method: Style::green

function green($text, $args) : string

Magic Method: Style::cyan

function cyan($text, $args) : string

Magic Method: Style::red

function red($text, $args) : string

Magic Method: Style::purple

function purple($text, $args) : string

Magic Method: Style::brown

function brown($text, $args) : string

Magic Method: Style::light_gray

function light_gray($text, $args) : string

Magic Method: Style::normal

function normal($text, $args) : string

Magic Method: Style::dim

function dim($text, $args) : string

Magic Method: Style::dark_gray

function dark_gray($text, $args) : string

Magic Method: Style::light_blue

function light_blue($text, $args) : string

Magic Method: Style::light_green

function light_green($text, $args) : string

Magic Method: Style::light_cyan

function light_cyan($text, $args) : string

Magic Method: Style::light_red

function light_red($text, $args) : string

Magic Method: Style::light_purple

function light_purple($text, $args) : string

Magic Method: Style::yellow

function yellow($text, $args) : string

Magic Method: Style::white

function white($text, $args) : string

Undocumented Method: Style::__callStatic($foreground_color, $args)