Пример #1
0
 /**
  * Display help content for this command.
  *
  * The basic command name and description, any avaialble aliases, and
  * any avaialble examples are all included in the help display.
  *
  * This content can be accessed by called "--help" on this command
  * directly:
  *
  * ./vendor/bin/dewdrop my-command --help
  *
  * Or, you can use the built-in help command to access it:
  *
  * ./vendor/bin/dewdrop help my-command
  *
  * @return void
  */
 public function help()
 {
     $this->renderer->title($this->getCommand())->text($this->getDescription());
     if (count($this->aliases)) {
         $this->renderer->text('Aliases: ' . implode(', ', $this->aliases));
     }
     $this->renderer->newline();
     if (count($this->examples)) {
         $this->renderer->subhead('Examples');
         foreach ($this->examples as $example) {
             $this->renderer->text(rtrim($example['description'], ':') . ':')->text('    ' . $example['command'])->newline();
         }
     }
     if (count($this->args)) {
         $this->renderer->subhead('Arguments');
         $rows = array();
         foreach ($this->args as $arg) {
             $title = '--' . $arg['name'];
             $rows[$title] = sprintf('%s (%s)', $arg['description'], $arg['required'] ? 'Required' : 'Optional');
         }
         $this->renderer->table($rows);
     }
     return $this;
 }