From edcc1bbe45c1947d0cc29e3a73826d5595318a8e Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Sat, 11 Oct 2025 07:39:54 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(cli):=20add=20skip-delete=20fl?= =?UTF-8?q?ag=20to=20cli?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - introduce a new flag `--skip-delete` - add a new option to skip rules with `delete` action --- src/cli/run_cli.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/cli/run_cli.rs b/src/cli/run_cli.rs index 928b0f9..d3f4ec3 100644 --- a/src/cli/run_cli.rs +++ b/src/cli/run_cli.rs @@ -6,6 +6,9 @@ pub struct RunCli { /// Skip any rules that apply the action `trash` #[clap(short = 't', long)] skip_trash: bool, + /// Skip any rules that apply the action `delete` + #[clap(short = 'd', long)] + skip_delete: bool, } impl RunCli { @@ -42,12 +45,16 @@ impl RunCli { } } EolAction::Delete => { - log::info!("deleting older messages"); - match processor.delete_messages(&label).await { - Ok(_) => {} - Err(e) => { - log::warn!("action failed for label {label} with error {e}"); + if !self.skip_delete { + log::info!("deleting older messages"); + match processor.delete_messages(&label).await { + Ok(_) => {} + Err(e) => { + log::warn!("action failed for label {label} with error {e}"); + } } + } else { + log::warn!("Rule with `delete` action for label `{label}` skipped."); } } }