public function interactAskForStack(InputInterface $input, OutputInterface $output, $nameFilter = null, $statusFilter = null)
{
$stack = $input->getArgument('stack');
if (empty($stack)) {
$choices = $this->getStacks($nameFilter, $statusFilter);
if (count($choices) == 0) {
throw new \Exception('No valid stacks found.');
}
if (count($choices) == 1) {
$stack = end($choices);
} else {
$helper = $this->getHelper('question');
$question = new ChoiceQuestion('Please select a stack', $choices);
$question->setErrorMessage('Stack %s is invalid.');
$stack = $helper->ask($input, $output, $question);
}
$output->writeln('Selected Stack: ' . $stack);
$input->setArgument('stack', $stack);
}
return $stack;
}