/** * Render the provided error message and display the command's help content. * * @param string $errorMessage * @param boolean $displayHelp * * @return boolean */ protected function abort($errorMessage, $displayHelp = true) { $this->renderer->error($errorMessage); if ($displayHelp) { $this->help(); } else { $this->renderer->newline(); } return false; }
/** * Find the selected command, if any, and execute it. If no command is * selected, display the default help content instead. Either way, * execution is halted after this method is done. * * @return void */ public function run() { $this->instantiateCommands(); /* @var $command CommandAbstract */ foreach ($this->commands as $name => $command) { if ($command->isSelected($this->command)) { $this->executeCommand($name); $this->halt(); return; } } $this->renderer->error('Please specify a valid command as the first argument.'); $this->executeCommand('Help'); $this->halt(); }