$args
$args : array
Contains arguments parsed from the command line.
Shell dispatcher handles dispatching cli commands.
Consult /bin/cake.php for how this class is used in practice.
__construct(array $args = array(), boolean $bootstrap = true)
Constructor
The execution of the script is stopped after dispatching the request with a status code of either 0 or 1 according to the result of the dispatch.
array | $args | the argv from PHP |
boolean | $bootstrap | Should the environment be bootstrapped. |
alias(string $short, string|null $original = null) : string|false
Add an alias for a shell command.
Aliases allow you to call shells by alternate names. This is most useful when dealing with plugin shells that you want to have shorter names for.
If you re-use an alias the last alias set will be the one available.
Aliasing a shell named ClassName:
$this->alias('alias', 'ClassName');
Getting the original name for a given alias:
$this->alias('alias');
string | $short | The new short name for the shell. |
string|null | $original | The original full name for the shell. |
The aliased class name, or false if the alias does not exist
dispatch(array $extra = array()) : integer
Dispatches a CLI request
Converts a shell command result into an exit code. Null/True are treated as success. All other return values are an error.
array | $extra | Extra parameters that you can manually pass to the Shell to be dispatched. Built-in extra parameter is :
|
The cli command exit code. 0 is success.
findShell(string $shell) : \Cake\Console\Shell
Get shell to use, either plugin shell or application shell
All paths in the loaded shell paths are searched, handles alias dereferencing
string | $shell | Optionally the name of a plugin |
when errors are encountered.
A shell instance.
_dispatch(array $extra = array()) : boolean|integer|null
Dispatch a request.
array | $extra | Extra parameters that you can manually pass to the Shell to be dispatched. Built-in extra parameter is :
|
_createShell(string $className, string $shortName) : \Cake\Console\Shell
Create the given shell name, and set the plugin property
string | $className | The class name to instantiate |
string | $shortName | The plugin-prefixed shell name |
A shell instance.
Loading…