protected function execute(InputInterface $input, OutputInterface $output)
{
$found = false;
$alternatives = array();
$extensions = $this->callMageScript($input, $output, 'list-available');
$searchPackage = $input->getArgument('package');
foreach (preg_split('/' . PHP_EOL . '/', $extensions) as $line) {
$matches = $this->matchConnectLine($line);
if (!empty($matches)) {
if ($matches[1] == $searchPackage) {
$found = true;
break 1;
} else {
if ($this->isAlternative($matches[1], $searchPackage)) {
$alternatives[] = $matches[1];
}
}
}
}
if ($found) {
$this->doAction($input, $output, $searchPackage);
} else {
$output->writeln('<comment>Could not find package.</comment>');
if (count($alternatives) > 0) {
$this->doAction($input, $output, $this->askForAlternativePackage($alternatives, $output));
}
}
}