Adding Shell::dispatchShell() will replace $this->Dispatch->dispatch use in Shells.

This commit is contained in:
mark_story 2010-10-16 01:28:59 -04:00
parent e85482f702
commit 28fc07c055

View file

@ -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
*