/** * Tries to return autocompletion for the current entered text. * * * @return bool|array A list of guessed strings or true * @codeCoverageIgnore */ private function autocompleter() { $info = readline_info(); $text = substr($info['line_buffer'], 0, $info['end']); if ($info['point'] !== $info['end']) { return true; } // task name? if (false === strpos($text, ' ') || !$text) { $commands = array_keys($this->application->all()); $commands[] = 'quit'; $commands[] = 'all'; return $commands; } // options and arguments? try { $command = $this->application->find(substr($text, 0, strpos($text, ' '))); } catch (\Exception $e) { return true; } $list = array('--help'); foreach ($command->getDefinition()->getOptions() as $option) { $opt = '--' . $option->getName(); if (!in_array($opt, $list)) { $list[] = $opt; } } return $list; }
public function doRun(InputInterface $input, OutputInterface $output) { $this->getContainer()->setParameter('runner.tty', false); $command = $this->getCommandName($input); $output->writeln('Running start: ' . $command); return parent::doRun($input, $output); }