Skip to content

Commit 7a4e683

Browse files
authored
Merge pull request #855 from Brammm-forks/worker
Add a `--force` param to skip the prompt
2 parents 030b541 + bc92a81 commit 7a4e683

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/Console/Command/SubscriptionRemoveCommand.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
namespace Patchlevel\EventSourcing\Console\Command;
66

7+
use Patchlevel\EventSourcing\Console\InputHelper;
78
use Patchlevel\EventSourcing\Console\OutputStyle;
89
use Symfony\Component\Console\Attribute\AsCommand;
910
use Symfony\Component\Console\Input\InputInterface;
11+
use Symfony\Component\Console\Input\InputOption;
1012
use Symfony\Component\Console\Output\OutputInterface;
1113

1214
#[AsCommand(
@@ -15,13 +17,20 @@
1517
)]
1618
final class SubscriptionRemoveCommand extends SubscriptionCommand
1719
{
20+
protected function configure(): void
21+
{
22+
$this
23+
->addOption('force', 'f', InputOption::VALUE_NONE, 'Set this parameter to execute this action without prompting');
24+
}
25+
1826
protected function execute(InputInterface $input, OutputInterface $output): int
1927
{
2028
$io = new OutputStyle($input, $output);
2129

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

24-
if ($criteria->ids === null) {
33+
if ($criteria->ids === null && !$force) {
2534
if (!$io->confirm('do you want to remove all subscriptions?', false)) {
2635
return 1;
2736
}

0 commit comments

Comments
 (0)