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,12 +45,16 @@ impl RunCli {
} }
} }
EolAction::Delete => { EolAction::Delete => {
log::info!("deleting older messages"); if !self.skip_delete {
match processor.delete_messages(&label).await { log::info!("deleting older messages");
Ok(_) => {} match processor.delete_messages(&label).await {
Err(e) => { Ok(_) => {}
log::warn!("action failed for label {label} with error {e}"); Err(e) => {
log::warn!("action failed for label {label} with error {e}");
}
} }
} else {
log::warn!("Rule with `delete` action for label `{label}` skipped.");
} }
} }
} }