Skip to content

Commit

Permalink
Improve message when shell is not detected
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Nov 15, 2022
1 parent 3836ffa commit dcda527
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Command/DumpCompletionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if (!file_exists($completionFile)) {
$supportedShells = $this->getSupportedShells();

($output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output)
->writeln(sprintf('<error>Detected shell "%s", which is not supported by Symfony shell completion (supported shells: "%s").</>', $shell, implode('", "', $supportedShells)));
if ($output instanceof ConsoleOutputInterface) {
$output = $output->getErrorOutput();
}
if ($shell) {
$output->writeln(sprintf('<error>Detected shell "%s", which is not supported by Symfony shell completion (supported shells: "%s").</>', $shell, implode('", "', $supportedShells)));
} else {
$output->writeln(sprintf('<error>Shell not detected, Symfony shell completion only supports "%s").</>', implode('", "', $supportedShells)));
}

return self::INVALID;
}
Expand Down

0 comments on commit dcda527

Please sign in to comment.