/** * 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(); }
/** * 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(); }
public function testLoadFile() { $file_name = '/tmp/testfile'; setOutputDestination($file_name); Utils\loadFile($file_name); resetOutputDestination($file_name); $included_files = get_included_files(); $is_included = array_search($file_name, $included_files) !== false || array_search("/private{$file_name}", $included_files) !== false; $this->assertTrue($is_included); }
public function run() { if (Terminus::isTest()) { return true; } 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->find_command_to_run($this->arguments); if (is_array($r)) { list($command) = $r; if ($command->can_have_subcommands()) { $command->show_usage(); exit; } } } catch (TerminusException $e) { // Do nothing. Actual error handling will be done by _runCommand } // First try at showing man page if ('help' === $this->arguments[0] && isset($this->arguments[1])) { $this->_runCommand(); } # Run the stinkin command! $this->_runCommand(); }