Skip to content

Commit

Permalink
Fixes to global completion, working in some cases now
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed May 12, 2022
1 parent 0089a69 commit 6aa7e15
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Composer/Command/GlobalCommand.php
Expand Up @@ -36,12 +36,16 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
$suggestions->suggestValues(array_filter(array_map(function (Command $command) {
return $command->isHidden() ? null : $command->getName();
}, $application->all())));

return;
}

if ($application->has($commandName = $input->getArgument('command-name'))) {
$input = $this->prepareSubcommandInput($input, true);
$input = CompletionInput::fromString($input->__toString(), 3);
$command = $this->getApplication()->find($commandName);
$input = CompletionInput::fromString($input->__toString(), 2);
$command = $application->find($commandName);
$command->mergeApplicationDefinition();

$input->bind($command->getDefinition());
$command->complete($input, $suggestions);
}
Expand Down

0 comments on commit 6aa7e15

Please sign in to comment.