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\ConsoleCode
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());
}
}