feat(cli): add skip-delete flag to cli

- introduce a new flag `--skip-delete`
- add a new option to skip rules with `delete` action
This commit is contained in:
Jeremiah Russell
2025-10-11 07:39:54 +01:00
committed by Jeremiah Russell
parent 1997fd2142
commit edcc1bbe45

View File

@@ -6,6 +6,9 @@ pub struct RunCli {
/// Skip any rules that apply the action `trash` /// Skip any rules that apply the action `trash`
#[clap(short = 't', long)] #[clap(short = 't', long)]
skip_trash: bool, skip_trash: bool,
/// Skip any rules that apply the action `delete`
#[clap(short = 'd', long)]
skip_delete: bool,
} }
impl RunCli { impl RunCli {
@@ -42,6 +45,7 @@ impl RunCli {
} }
} }
EolAction::Delete => { EolAction::Delete => {
if !self.skip_delete {
log::info!("deleting older messages"); log::info!("deleting older messages");
match processor.delete_messages(&label).await { match processor.delete_messages(&label).await {
Ok(_) => {} Ok(_) => {}
@@ -49,6 +53,9 @@ impl RunCli {
log::warn!("action failed for label {label} with error {e}"); log::warn!("action failed for label {label} with error {e}");
} }
} }
} else {
log::warn!("Rule with `delete` action for label `{label}` skipped.");
}
} }
} }
} }