private function getTaskFromInput(InputInterface $input, OutputInterface $output)
{
$commands = $this->getCommands();
$task = $input->getArgument('task');
if (null !== $task) {
if (!in_array($task, $commands)) {
throw new \InvalidArgumentException(sprintf('Invalid task "%s"', $task));
// no full stop here
}
return $task;
}
$question = new ChoiceQuestion('Please select a task:', $commands, 0);
$question->setMaxAttempts(1);
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
return $helper->ask($input, $output, $question);
}