mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Reverting change for console help, and improving it so it returns help for the command intended to be run
This commit is contained in:
parent
63fd35b384
commit
1d384ec68f
2 changed files with 24 additions and 25 deletions
|
@ -333,10 +333,14 @@ class Shell extends Object {
|
|||
array_shift($argv);
|
||||
}
|
||||
|
||||
$this->OptionParser = $this->getOptionParser();
|
||||
list($this->params, $this->args) = $this->OptionParser->parse($argv, $command);
|
||||
try {
|
||||
$this->OptionParser = $this->getOptionParser();
|
||||
list($this->params, $this->args) = $this->OptionParser->parse($argv, $command);
|
||||
} catch (ConsoleException $e) {
|
||||
return $this->out($this->OptionParser->help($command));
|
||||
}
|
||||
|
||||
$this->command = $command;
|
||||
|
||||
if (!empty($this->params['help'])) {
|
||||
return $this->_displayHelp($command);
|
||||
}
|
||||
|
|
|
@ -171,30 +171,25 @@ class ShellDispatcher {
|
|||
$command = $this->args[0];
|
||||
}
|
||||
|
||||
try {
|
||||
if ($Shell instanceof Shell) {
|
||||
$Shell->initialize();
|
||||
$Shell->loadTasks();
|
||||
return $Shell->runCommand($command, $this->args);
|
||||
}
|
||||
$methods = array_diff(get_class_methods($Shell), get_class_methods('Shell'));
|
||||
$added = in_array($command, $methods);
|
||||
$private = $command[0] == '_' && method_exists($Shell, $command);
|
||||
if ($Shell instanceof Shell) {
|
||||
$Shell->initialize();
|
||||
$Shell->loadTasks();
|
||||
return $Shell->runCommand($command, $this->args);
|
||||
}
|
||||
$methods = array_diff(get_class_methods($Shell), get_class_methods('Shell'));
|
||||
$added = in_array($command, $methods);
|
||||
$private = $command[0] == '_' && method_exists($Shell, $command);
|
||||
|
||||
if (!$private) {
|
||||
if ($added) {
|
||||
$this->shiftArgs();
|
||||
$Shell->startup();
|
||||
return $Shell->{$command}();
|
||||
}
|
||||
if (method_exists($Shell, 'main')) {
|
||||
$Shell->startup();
|
||||
return $Shell->main();
|
||||
}
|
||||
if (!$private) {
|
||||
if ($added) {
|
||||
$this->shiftArgs();
|
||||
$Shell->startup();
|
||||
return $Shell->{$command}();
|
||||
}
|
||||
if (method_exists($Shell, 'main')) {
|
||||
$Shell->startup();
|
||||
return $Shell->main();
|
||||
}
|
||||
} catch(ConsoleException $e) {
|
||||
$this->help();
|
||||
$this->_stop(1);
|
||||
}
|
||||
throw new MissingShellMethodException(array('shell' => $shell, 'method' => $arg));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue