Skip to content

Latest commit

 

History

History
470 lines (296 loc) · 6.82 KB

DOCS.md

File metadata and controls

470 lines (296 loc) · 6.82 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
  • boolean $erase - Clear the line before drawing the passed string

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

<?php
namespace CLI;

class Style {
	public static $foreground_colors = array('bold' => '1', 'dim' => '2', 'black' => '0;30', 'dark_gray' => '1;30', 'blue' => '0;34', 'light_blue' => '1;34', 'green' => '0;32', 'light_green' => '1;32', 'cyan' => '0;36', 'light_cyan' => '1;36', 'red' => '0;31', 'light_red' => '1;31', 'purple' => '0;35', 'light_purple' => '1;35', 'brown' => '0;33', 'yellow' => '1;33', 'light_gray' => '0;37', 'white' => '1;37', 'normal' => '0;39');
	public static $background_colors = array('black' => '40', 'red' => '41', 'green' => '42', 'yellow' => '43', 'blue' => '44', 'magenta' => '45', 'cyan' => '46', 'light_gray' => '47');
	public static $options = array('underline' => '4', 'blink' => '5', 'reverse' => '7', 'hidden' => '8');
}

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