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

Breadcrumb

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

function TextDescriptor::describeCommand

Overrides Descriptor::describeCommand

File

vendor/symfony/console/Descriptor/TextDescriptor.php, line 125

Class

TextDescriptor
Text descriptor.

Namespace

Symfony\Component\Console\Descriptor

Code

protected function describeCommand(Command $command, array $options = []) : void {
    $command->mergeApplicationDefinition(false);
    if ($description = $command->getDescription()) {
        $this->writeText('<comment>Description:</comment>', $options);
        $this->writeText("\n");
        $this->writeText('  ' . $description);
        $this->writeText("\n\n");
    }
    $this->writeText('<comment>Usage:</comment>', $options);
    foreach (array_merge([
        $command->getSynopsis(true),
    ], $command->getAliases(), $command->getUsages()) as $usage) {
        $this->writeText("\n");
        $this->writeText('  ' . OutputFormatter::escape($usage), $options);
    }
    $this->writeText("\n");
    $definition = $command->getDefinition();
    if ($definition->getOptions() || $definition->getArguments()) {
        $this->writeText("\n");
        $this->describeInputDefinition($definition, $options);
        $this->writeText("\n");
    }
    $help = $command->getProcessedHelp();
    if ($help && $help !== $description) {
        $this->writeText("\n");
        $this->writeText('<comment>Help:</comment>', $options);
        $this->writeText("\n");
        $this->writeText('  ' . str_replace("\n", "\n  ", $help), $options);
        $this->writeText("\n");
    }
}

API Navigation

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