protected function execute(InputInterface $input, OutputInterface $output)
{
if ($this->isInstalled() === false) {
throw new RuntimeException('Invalid Kirby installation');
}
// bootstrap kirby, just in case
$this->bootstrap();
if ($name = $input->getArgument('name')) {
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('<info>Do you really want to delete the "' . $name . '" ' . $this->type . '? (y/n)</info>' . PHP_EOL . 'leave blank to cancel: ', false);
if ($helper->ask($input, $output, $question)) {
$this->delete($name, $output);
}
} else {
$selection = $this->selection();
if (empty($selection)) {
$output->writeln('<info>There are no installed ' . $this->type . '</info>');
$output->writeln('');
return;
}
$helper = $this->getHelper('question');
$question = new ChoiceQuestion('<info>Which ' . $this->type . ' do you want to delete?</info>', $selection, 0);
$item = $helper->ask($input, $output, $question);
// add some space
$output->writeln('');
$this->delete($item, $output);
}
}