Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. GlobalCommand.php

function GlobalCommand::complete

Overrides BaseCommand::complete

File

vendor/composer/composer/src/Composer/Command/GlobalCommand.php, line 32

Class

GlobalCommand
@author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\Command

Code

public function complete(CompletionInput $input, CompletionSuggestions $suggestions) : void {
    $application = $this->getApplication();
    if ($input->mustSuggestArgumentValuesFor('command-name')) {
        $suggestions->suggestValues(array_values(array_filter(array_map(static function (Command $command) {
            return $command->isHidden() ? null : $command->getName();
        }, $application->all()), function (?string $cmd) {
            return $cmd !== null;
        })));
        return;
    }
    if ($application->has($commandName = $input->getArgument('command-name'))) {
        $input = $this->prepareSubcommandInput($input, true);
        $input = CompletionInput::fromString($input->__toString(), 2);
        $command = $application->find($commandName);
        $command->mergeApplicationDefinition();
        $input->bind($command->getDefinition());
        $command->complete($input, $suggestions);
    }
}
RSS feed
Powered by Drupal