BashCompletionOutput.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | namespace IAWP_SCOPED\Symfony\Component\Console\Completion\Output; |
| 12 | |
| 13 | use IAWP_SCOPED\Symfony\Component\Console\Completion\CompletionSuggestions; |
| 14 | use IAWP_SCOPED\Symfony\Component\Console\Output\OutputInterface; |
| 15 | /** |
| 16 | * @author Wouter de Jong <wouter@wouterj.nl> |
| 17 | * @internal |
| 18 | */ |
| 19 | class BashCompletionOutput implements CompletionOutputInterface |
| 20 | { |
| 21 | public function write(CompletionSuggestions $suggestions, OutputInterface $output) : void |
| 22 | { |
| 23 | $values = $suggestions->getValueSuggestions(); |
| 24 | foreach ($suggestions->getOptionSuggestions() as $option) { |
| 25 | $values[] = '--' . $option->getName(); |
| 26 | if ($option->isNegatable()) { |
| 27 | $values[] = '--no-' . $option->getName(); |
| 28 | } |
| 29 | } |
| 30 | $output->writeln(\implode("\n", $values)); |
| 31 | } |
| 32 | } |
| 33 |