Skip to content

Commit d4fab7f

Browse files
committed
bug #48217 [Console] Improve error message when shell is not detected in completion command (GromNaN)
This PR was merged into the 5.4 branch. Discussion ---------- [Console] Improve error message when shell is not detected in completion command | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #48171 | License | MIT Commits ------- 7534fb1 Improve message when shell is not detected
2 parents d4162b3 + 7534fb1 commit d4fab7f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Symfony/Component/Console/Command/DumpCompletionCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9393
if (!file_exists($completionFile)) {
9494
$supportedShells = $this->getSupportedShells();
9595

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

99105
return self::INVALID;
100106
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy