Exemplo n.º 1
0
}
\PHPCli\Cli::new_line(2);
\PHPCli\Cli::heading("Text Error Output");
\PHPCli\Cli::error("Failure: This is a plain error message");
\PHPCli\Cli::error("Failure: This is a error message with a yellow foreground colour", \PHPCli\Color::$yellow);
\PHPCli\Cli::error("Failure: This is a string with a white foreground and Red Background", \PHPCli\Color::$white, \PHPCli\BackgroundColor::$red);
\PHPCli\Cli::new_line(2);
\PHPCli\Cli::heading("Prompt for input");
//Prompt for input
$colour = \PHPCli\Cli::prompt("What is your favorite colour?");
\PHPCli\Cli::write("I also like " . $colour);
// Takes any input, but offers default
$colour = \PHPCli\Cli::prompt('What is your favorite color?', 'white');
\PHPCli\Cli::write("I also like " . $colour);
// Will only accept the options in the array
$ready = \PHPCli\Cli::prompt('Are you ready to continue?', array('y', 'n'));
\PHPCli\Cli::new_line(2);
\PHPCli\Cli::heading("Progress Bar");
//Simple Example
$size = 10;
\PHPCli\ProgressBar::start($size);
for ($i = 1; $i <= $size; $i++) {
    \PHPCli\ProgressBar::next();
    \PHPCli\Cli::wait(1);
}
\PHPCli\ProgressBar::finish();
//Update message
$size = 10;
\PHPCli\ProgressBar::start($size, "Starting in about 5 seconds");
\PHPCli\Cli::wait(5);
\PHPCli\ProgressBar::setMessage('Go!');