_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)
int
the number of times to beep
clear_screen() : void
color(string $text, string $foreground, string $background, string $format) : string
string
the text to color
string
the foreground color
string
the background color
string
other formatting to apply. Currently only 'underline' is understood
\FuelException |
---|
string
the color coded stringerror(string | array $text, string $foreground, string $background)
string
array
the text to output, or array of errors
string
the foreground color
string
the 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
string
int
the name of the option (int if unnamed)
string
is_windows()
new_line(integer $num) : void
integer
Number 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
string
int
the name of the option (int if unnamed)
mixed
value to return if the option is not defined
mixed
prompt() : 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'));
string
the user inputset_option(string | int $name, mixed | null $value) : mixed
string
int
the name of the option (int if unnamed)
mixed
null
value to set, or null to delete the option
mixed
spawn(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/ |
string
the 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.
resource
string
Opened filehandle or string filename.
resource
stdout(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.
resource
string
null
Opened filehandle or string filename.
resource
wait(int $seconds, bool $countdown)
int
number of seconds
bool
show 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.
string
array
the text to output, or array of lines
string
the foreground color
string
the foreground color
\FuelException |
---|
$nocolor
$readline_support
$wait_msg
$STDERR
$STDOUT
$args
$background_colors
$foreground_colors