/**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @throws \Exception
  * @throws \Symfony\Component\Console\Exception\ExceptionInterface
  */
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     # print the status list
     /** @var StatusCommand $command */
     $command = $this->getApplication()->find('status');
     $statusInput = new ArrayInput(array(), $command->getDefinition());
     $command->run($statusInput, $output);
     foreach (array_keys($this->actions) as $name) {
         # ask with boxes to handle
         $helper = $this->getHelper('question');
         $question = new Question('<fg=yellow>' . "Select box/boxes to " . $name . ' []:</> ', null);
         $question->setMaxAttempts(5);
         # set up validation for the question
         $question->setValidator(function ($answer) {
             $vagrant = new Vagrant();
             # check if the answer can be resolved
             if ($answer != "" && !count($vagrant->resolveStr($answer))) {
                 throw new \RuntimeException('Your selection does not match any boxes');
             }
             return $answer;
         });
         # if we have an answer, set it as an argument, and move on
         if ($answer = $helper->ask($input, $output, $question)) {
             $this->actions[$name]["boxes"] = $answer;
         }
     }
 }
 /**
  * Should return (one of)
  *      array of \Klang\App\Service\Vagrant\Host
  *      null, if no input is given (empty identifier)
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return null|array(\Klang\App\Service\Vagrant\Host)
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function getHostList(InputInterface $input, OutputInterface $output)
 {
     $vagrant = new Vagrant();
     $inputStr = $input->getArgument("identifier");
     if ($inputStr === null) {
         return null;
     } else {
         $hosts = [];
         # handle all boxes that match the inputStr
         foreach ($vagrant->resolveStr($inputStr) as $id) {
             /** @var \Klang\App\Service\Vagrant\Host $host */
             $host = $vagrant->lookupBox($id);
             $hosts[] = $host;
             unset($host);
         }
         return $hosts;
     }
 }