Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/Console/Command/SubscriptionRemoveCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

namespace Patchlevel\EventSourcing\Console\Command;

use Patchlevel\EventSourcing\Console\InputHelper;
use Patchlevel\EventSourcing\Console\OutputStyle;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
Expand All @@ -15,13 +17,20 @@
)]
final class SubscriptionRemoveCommand extends SubscriptionCommand
{
protected function configure(): void
{
$this
->addOption('force', 'f', InputOption::VALUE_NONE, 'Set this parameter to execute this action without prompting');
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new OutputStyle($input, $output);

$criteria = $this->subscriptionEngineCriteria($input);
$force = InputHelper::bool($input->getOption('force'));

if ($criteria->ids === null) {
if ($criteria->ids === null && !$force) {
if (!$io->confirm('do you want to remove all subscriptions?', false)) {
return 1;
}
Expand Down
Loading