_init()
beep()
clear_screen()
color()
error()
input()
is_windows()
new_line()
option()
prompt()
set_option()
spawn()
stderr()
stdout()
wait()
write()
$nocolor
$readline_support
$wait_msg
$STDERR
$STDOUT
$args
$background_colors
$foreground_colors
Cli class
Interact with the command line by accepting input options, parameters and output text
| package | Fuel |
|---|---|
| category | Core |
| author | Phil Sturgeon |
| link | http://docs.fuelphp.com/classes/cli.html |
_init()
Parses all the CLI params.
beep(int $num)
intthe number of times to beep
clear_screen() : void
color(string $text, string $foreground, string $background, string $format) : string
stringthe text to color
stringthe foreground color
stringthe background color
stringother formatting to apply. Currently only 'underline' is understood
\FuelException |
|---|
stringthe color coded stringerror(string | array $text, string $foreground, string $background)
stringarraythe text to output, or array of errors
stringthe foreground color
stringthe foreground color
\FuelException |
|---|
input(string | int $prefix) : string
Named options must be in the following formats: php index.php user -v --v -name=John --name=John
stringintthe name of the option (int if unnamed)
stringis_windows()
new_line(integer $num) : void
integerNumber of lines to output
option(string | int $name, mixed $default) : mixed
You can also give the option number.
Named options must be in the following formats: php index.php user -v --v -name=John --name=John
stringintthe name of the option (int if unnamed)
mixedvalue to return if the option is not defined
mixedprompt() : string
This can have either 1 or 2 arguments.
Usage:
// Waits for any key press CLI::prompt();
// Takes any input $color = CLI::prompt('What is your favorite color?');
// Takes any input, but offers default $color = CLI::prompt('What is your favourite color?', 'white');
// Will only accept the options in the array $ready = CLI::prompt('Are you ready?', array('y','n'));
stringthe user inputset_option(string | int $name, mixed | null $value) : mixed
stringintthe name of the option (int if unnamed)
mixednullvalue to set, or null to delete the option
mixedspawn(string $call, string $output) : void
Launches a background process (note, provides no security itself, $call must be sanitised prior to use)
| author | raccettura |
|---|---|
| link | http://robert.accettura.com/blog/2006/09/14/asynchronous-processing-with-php/ |
stringthe system call to make
string
stderr(resource | string $fh) : resource
Call with no argument to retrieve the current filehandle.
Is not smart about opening the file if it's a string. Existing files will be truncated.
resourcestringOpened filehandle or string filename.
resourcestdout(resource | string | null $fh) : resource
Call with no argument to retrieve the current filehandle.
Is not smart about opening the file if it's a string. Existing files will be truncated.
resourcestringnullOpened filehandle or string filename.
resourcewait(int $seconds, bool $countdown)
intnumber of seconds
boolshow a countdown or not
write(string | array $text, string $foreground, string $background)
If you send an array it will implode them with a line break.
stringarraythe text to output, or array of lines
stringthe foreground color
stringthe foreground color
\FuelException |
|---|
$nocolor
$readline_support
$wait_msg
$STDERR
$STDOUT
$args
$background_colors
$foreground_colors