/** * Creates and returns a command */ public function createCommand($name, $spec, PropertyProvider $propertyProvider) { $command = new TaskCommand($name, $this->getScript($spec), $this->executor); $command->setDescription($this->getDescription($spec)); $command->setProperties($this->getProperties($spec, $propertyProvider)); return $command; }
/** * Execute the command * @param $command TaskCommand * @param $input InputInterface * @param $output OutputInterface */ public function execute(TaskCommand $command, InputInterface $input, OutputInterface $output) { $status = $this->passthru($command->getScript() . ' ' . $command->getArgs()); var_dump($status); }
/** * {@inheretDoc} */ public function makeReady(TaskCommand $command, InputInterface $input, OutputInterface $output) { if ($this->value !== null) { return; } $questionHelper = $command->getHelper('question'); $prompt = array($this->getDescription(), PHP_EOL, $this->getName()); if ($this->getDefault() !== null) { $prompt[] = sprintf(' [%s]', $this->getDefault()); } $prompt[] = ': '; $question = new Question(implode('', $prompt), $this->getDefault()); $this->setValue($questionHelper->ask($input, $output, $question)); }