You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Command/CompleteCommand.php
+15-6Lines changed: 15 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -31,16 +31,25 @@ final class CompleteCommand extends Command
31
31
protectedstatic$defaultName = '|_complete';
32
32
protectedstatic$defaultDescription = 'Internal command to provide shell completion suggestions';
33
33
34
-
privatestatic$completionOutputs = [
35
-
'bash' => BashCompletionOutput::class,
36
-
];
34
+
private$completionOutputs;
37
35
38
36
private$isDebug = false;
39
37
38
+
/**
39
+
* @param array<string, class-string<CompletionOutputInterface>> $completionOutputs A list of additional completion outputs, with shell name as key and FQCN as value
->addOption('shell', 's', InputOption::VALUE_REQUIRED, 'The shell type (e.g. "bash")')
52
+
->addOption('shell', 's', InputOption::VALUE_REQUIRED, 'The shell type ("'.implode('", "', array_keys($this->completionOutputs)).'")')
44
53
->addOption('input', 'i', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'An array of input tokens (e.g. COMP_WORDS or argv)')
45
54
->addOption('current', 'c', InputOption::VALUE_REQUIRED, 'The index of the "input" array that the cursor is in (e.g. COMP_CWORD)')
46
55
->addOption('symfony', 'S', InputOption::VALUE_REQUIRED, 'The version of the completion script')
@@ -71,8 +80,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
71
80
thrownew \RuntimeException('The "--shell" option must be set.');
72
81
}
73
82
74
-
if (!$completionOutput = self::$completionOutputs[$shell] ?? false) {
75
-
thrownew \RuntimeException(sprintf('Shell completion is not supported for your shell: "%s" (supported: "%s").', $shell, implode('", "', array_keys(self::$completionOutputs))));
83
+
if (!$completionOutput = $this->completionOutputs[$shell] ?? false) {
84
+
thrownew \RuntimeException(sprintf('Shell completion is not supported for your shell: "%s" (supported: "%s").', $shell, implode('", "', array_keys($this->completionOutputs))));
0 commit comments