diff --git a/src/Console/Command.php b/src/Console/Command.php index a6e208186f0..fd8c0276a9f 100644 --- a/src/Console/Command.php +++ b/src/Console/Command.php @@ -18,8 +18,8 @@ use Cake\Datasource\ModelAwareTrait; use Cake\Log\LogTrait; use Cake\ORM\Locator\LocatorAwareTrait; -use RuntimeException; use InvalidArgumentException; +use RuntimeException; /** * Base class for console commands. @@ -150,7 +150,8 @@ public function initialize() /** * Run the command. * - * @param array $argv + * @param array $argv Arguments from the CLI environment. + * @param \Cake\Console\ConsoleIo $io The console io * @return int|null Exit code or null for success. */ public function run(array $argv, ConsoleIo $io) @@ -175,6 +176,7 @@ public function run(array $argv, ConsoleIo $io) if ($args->getOption('help')) { return $this->displayHelp($parser, $args, $io); } + return $this->execute($args, $io); } @@ -194,7 +196,7 @@ protected function displayHelp(ConsoleOptionParser $parser, Arguments $args, Con $io->setOutputAs(ConsoleOutput::RAW); } - return $io->out($parser->help(null, $format)); + $io->out($parser->help(null, $format)); } /** @@ -226,5 +228,6 @@ protected function setOutputLevel(Arguments $args, ConsoleIo $io) */ public function execute(Arguments $args, ConsoleIo $io) { + return null; } } diff --git a/src/Console/CommandRunner.php b/src/Console/CommandRunner.php index 7e8c9fdf0ad..22110f196b9 100644 --- a/src/Console/CommandRunner.php +++ b/src/Console/CommandRunner.php @@ -224,6 +224,7 @@ protected function runShell(Shell $shell, array $argv) { try { $shell->initialize(); + return $shell->runCommand($argv, true); } catch (StopException $e) { return $e->getCode(); @@ -234,7 +235,6 @@ protected function runShell(Shell $shell, array $argv) * The wrapper for creating shell instances. * * @param string $className Shell class name. - * @param string $name The name of the command. * @param \Cake\Console\ConsoleIo $io The IO wrapper for the created shell class. * @return \Cake\Console\Shell */