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

Breadcrumb

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

function Application::complete

Adds suggestions to $suggestions for the current completion input (e.g. option or argument).

File

vendor/symfony/console/Application.php, line 390

Class

Application
An Application is the container for a collection of commands.

Namespace

Symfony\Component\Console

Code

public function complete(CompletionInput $input, CompletionSuggestions $suggestions) : void {
    if (CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType() && 'command' === $input->getCompletionName()) {
        foreach ($this->all() as $name => $command) {
            // skip hidden commands and aliased commands as they already get added below
            if ($command->isHidden() || $command->getName() !== $name) {
                continue;
            }
            $suggestions->suggestValue(new Suggestion($command->getName(), $command->getDescription()));
            foreach ($command->getAliases() as $name) {
                $suggestions->suggestValue(new Suggestion($name, $command->getDescription()));
            }
        }
        return;
    }
    if (CompletionInput::TYPE_OPTION_NAME === $input->getCompletionType()) {
        $suggestions->suggestOptions($this->getDefinition()
            ->getOptions());
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal