/** * Runs the Terminus command * * @return void */ public function run() { if (empty($this->arguments)) { $this->arguments[] = 'help'; } // Load bundled commands early, so that they're forced to use the same // APIs as non-bundled commands. Utils\loadCommand($this->arguments[0]); if (isset($this->config['require'])) { foreach ($this->config['require'] as $path) { Utils\loadFile($path); } } try { // Show synopsis if it's a composite command. $r = $this->findCommandToRun($this->arguments); if (is_array($r)) { /** @var \Terminus\Dispatcher\RootCommand $command */ list($command) = $r; if ($command->canHaveSubcommands()) { $command->showUsage(); exit; } } } catch (TerminusException $e) { // Do nothing. Actual error-handling will be done by _runCommand $this->logger->debug($e->getMessage()); } // First try at showing man page if ($this->arguments[0] == 'help' && isset($this->arguments[1])) { $this->_runCommand(); } $this->_runCommand(); }
/** * Runs the Terminus command * * @return void */ public function run() { if (empty($this->arguments)) { $this->arguments[] = 'help'; } if (isset($this->config['require'])) { foreach ($this->config['require'] as $path) { Utils\loadFile($path); } } try { // Show synopsis if it's a composite command. $r = $this->findCommandToRun($this->arguments); if (is_array($r)) { /** @var \Terminus\Dispatcher\RootCommand $command */ list($command) = $r; if ($command->canHaveSubcommands()) { $command->showUsage(); exit; } } } catch (TerminusException $e) { $this->logger->debug($e->getMessage()); } $this->runCommand(); }