protected function execute(InputInterface $input, OutputInterface $output)
{
if ($this->isInstalled() === false) {
throw new RuntimeException('Invalid Kirby installation');
}
if ($plugin = $input->getArgument('name')) {
$this->uninstall($plugin, $output);
} else {
$plugins = array_keys($this->kirby()->plugins());
if (empty($plugins)) {
$output->writeln('<info>There are no installed plugins</info>');
$output->writeln('');
return;
}
$helper = $this->getHelper('question');
$question = new ChoiceQuestion('<info>Which plugin do you want to uninstall?</info>', $plugins, 0);
$plugin = $helper->ask($input, $output, $question);
// add some space
$output->writeln('');
$this->uninstall($plugin, $output);
}
}