You are here

protected function TextDescriptor::describeCommand in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Descriptor/TextDescriptor.php \Symfony\Component\Console\Descriptor\TextDescriptor::describeCommand()

Describes a Command instance.

Parameters

Command $command:

array $options:

Return value

string|mixed

Overrides Descriptor::describeCommand

File

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

Class

TextDescriptor
Text descriptor.

Namespace

Symfony\Component\Console\Descriptor

Code

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