/** * 执行指令 * @param Command $command 指令实例 * @param Input $input 输入实例 * @param Output $output 输出实例 * @return int * @throws \Exception */ protected function doRunCommand(Command $command, Input $input, Output $output) { return $command->run($input, $output); }
public function __construct() { parent::__construct("make:model"); }
public function __construct() { parent::__construct("make:controller"); }
public function run(Input $input, Output $output) { $this->input = $input; $this->output = $output; return parent::run($input, $output); }
/** * 描述指令 * @param Command $command * @param array $options * @return string|mixed */ protected function describeCommand(Command $command, array $options = []) { $command->getSynopsis(true); $command->getSynopsis(false); $command->mergeConsoleDefinition(false); $this->writeText('<comment>Usage:</comment>', $options); foreach (array_merge([$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"); } }