class MyCommand extends Command {
public function execute(array $args, array $options = array()) {
$this->writeln('hello world');
}
}
If "execute()" is not overriden, the execution will be forwarded to subcommand
methods. The subcommand name will be the first argument value and the associated
method must be prefixed with "execute".
class MyCommand extends Command {
public function executeSub1(array $args, array $options = array()) {
$this->writeln('hello world');
}
public function executeSub2(array $args, array $options = array()) {
$this->writeln('hello world');
}
}
Mostra file
Open project: maximebf/consolekit
Class Usage Examples
Property | Type | Description | |
---|---|---|---|
$console | |||
$defaultFormatOptions | array |
Method | Description | |
---|---|---|
__construct ( |
||
context ( array $formatOptions, Closure $closure ) | Executes the closure with a {@see FormatedWriter} object as the first argument, initialized with the $formatOptions array | |
execute ( array $args, array $options = [] ) | If not overriden, will execute the command specified as the first argument | |
format ( string $text, integer | array $formatOptions = [] ) : string | Formats text using a {@see TextFormater} | |
getConsole ( ) : |
||
write ( string $text, integer | array $formatOptions = [], integer $pipe = TextWriter::STDOUT ) : |
Writes some text to the text writer | |
writeerr ( string $text ) : |
Writes a message in bold red to STDERR | |
writeln ( string $text, integer | array $formatOptions = [], integer $pipe = TextWriter::STDOUT ) : |
Writes a line of text |
$this->context(array('quote' => ' * '), function($f) {
$f->writeln('quoted text');
})