mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding Shell::dispatchShell() will replace $this->Dispatch->dispatch use in Shells.
This commit is contained in:
parent
e85482f702
commit
28fc07c055
1 changed files with 16 additions and 0 deletions
|
@ -316,6 +316,22 @@ class Shell extends Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch a command to another Shell. Similar to Object::requestAction()
|
||||||
|
* but intended for running shells from other shells.
|
||||||
|
*
|
||||||
|
* @param mixed $command Either an array of args similar to $argv. Or a string command, that can be
|
||||||
|
* exploded on space to simulate argv.
|
||||||
|
* @return mixed. The return of the other shell.
|
||||||
|
*/
|
||||||
|
public function dispatchShell($command) {
|
||||||
|
if (is_string($command)) {
|
||||||
|
$command = explode(' ', $command);
|
||||||
|
}
|
||||||
|
$Dispatcher = new ShellDispatcher($command);
|
||||||
|
return $Dispatcher->dispatch();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the Shell with the provided argv
|
* Runs the Shell with the provided argv
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue