From b4982dfa769f36ac6cdec371b54a48702e13375d Mon Sep 17 00:00:00 2001 From: Orkhan Ahmadov Date: Wed, 17 Jan 2024 15:57:35 +0100 Subject: [PATCH] [1.x] Allow using `--force` on domain record deletion (#246) * Update RecordDeleteCommand.php * fixes --- src/Commands/RecordDeleteCommand.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Commands/RecordDeleteCommand.php b/src/Commands/RecordDeleteCommand.php index 477e5f91..8871eea5 100644 --- a/src/Commands/RecordDeleteCommand.php +++ b/src/Commands/RecordDeleteCommand.php @@ -4,6 +4,7 @@ use Laravel\VaporCli\Helpers; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; class RecordDeleteCommand extends Command { @@ -20,6 +21,7 @@ protected function configure() ->addArgument('type', InputArgument::REQUIRED, 'The record type') ->addArgument('name', InputArgument::OPTIONAL, 'The record name') ->addArgument('value', InputArgument::OPTIONAL, 'The record value') + ->addOption('force', false, InputOption::VALUE_NONE, 'Force deletion of the record without confirmation') ->setDescription('Delete a DNS record'); } @@ -30,7 +32,9 @@ protected function configure() */ public function handle() { - if (! Helpers::confirm('Are you sure you want to delete this record', false)) { + $forceDeletion = $this->option('force', false); + + if (! $forceDeletion && ! Helpers::confirm('Are you sure you want to delete this record', false)) { Helpers::abort('Action cancelled.'); }