From 6aa7e15373e1d0bd2bb060e09f360e07b6004fd6 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 12 May 2022 23:11:22 +0200 Subject: [PATCH] Fixes to global completion, working in some cases now --- src/Composer/Command/GlobalCommand.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/GlobalCommand.php b/src/Composer/Command/GlobalCommand.php index a99898e28..902ed4cb2 100644 --- a/src/Composer/Command/GlobalCommand.php +++ b/src/Composer/Command/GlobalCommand.php @@ -36,12 +36,16 @@ class GlobalCommand extends BaseCommand $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); }