Skip to content

Commit 099fda5

Browse files
committed
Fix command name not being completed when an existing command name is fully typed in
1 parent 8c09a56 commit 099fda5

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/Stecman/Component/Symfony/Console/BashCompletion/CompletionHandler.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,12 @@ protected function completeForOptionValues()
216216
*/
217217
protected function completeForCommandName()
218218
{
219-
if (!$this->command) {
219+
if (!$this->command || (count($this->words) == 2 && $this->wordIndex == 1)) {
220220
$commands = $this->application->all();
221-
$names = array();
221+
$names = array_keys($commands);
222222

223-
foreach ($commands as $cmd) {
224-
$name = $cmd->getName();
225-
if ($name != '_completion') {
226-
$names[] = $name;
227-
}
223+
if ($key = array_search('_completion', $names)) {
224+
unset($names[$key]);
228225
}
229226

230227
return $names;

0 commit comments

Comments
 (0)