feat(rules_cli): add option to immediately delete rules

- add `delete` flag to `add` command
- allow immediate deletion of rules instead of moving to trash
This commit is contained in:
Jeremiah Russell
2025-10-08 12:03:05 +01:00
committed by Jeremiah Russell
parent 5096fd2b19
commit 0bca3ed6f9

View File

@@ -33,6 +33,9 @@ pub struct AddCli {
/// Optional specific label; if not specified one will be generated /// Optional specific label; if not specified one will be generated
#[arg(short, long)] #[arg(short, long)]
label: Option<String>, label: Option<String>,
/// Immediate delete instead of move to trash
#[arg(long)]
delete: bool,
} }
impl AddCli { impl AddCli {
@@ -41,7 +44,7 @@ impl AddCli {
let message_age = MessageAge::new(self.period.to_string().as_str(), self.count); let message_age = MessageAge::new(self.period.to_string().as_str(), self.count);
let retention = Retention::new(message_age, generate); let retention = Retention::new(message_age, generate);
config.add_rule(retention, self.label.as_ref()); config.add_rule(retention, self.label.as_ref(), self.delete);
config.save() config.save()
} }
} }