From 4830d95a7603e9dd3024bd809d1a59ddc3f003de Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Wed, 8 Oct 2025 11:33:43 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(rules=5Fcli):=20add=20optional?= =?UTF-8?q?=20label=20for=20retention=20rules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - allows users to specify a custom label when adding a retention rule - if no label is provided, a unique one will be generated automatically --- src/rules_cli/add_cli.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rules_cli/add_cli.rs b/src/rules_cli/add_cli.rs index 7c135b1..3cb9144 100644 --- a/src/rules_cli/add_cli.rs +++ b/src/rules_cli/add_cli.rs @@ -30,16 +30,18 @@ pub struct AddCli { /// Count of the period #[arg(short, long, default_value = "1")] count: usize, - /// Flag to indicate that a label should be generated + /// Optional specific label; if not specified one will be generated #[arg(short, long)] - generate: bool, + label: Option, } impl AddCli { pub fn run(&self, mut config: Config) -> Result<(), Error> { + let generate = self.label.is_none(); let message_age = MessageAge::new(self.period.to_string().as_str(), self.count); - let retention = Retention::new(message_age, self.generate); - config.add_rule(retention); + let retention = Retention::new(message_age, generate); + + config.add_rule(retention, self.label.as_ref()); config.save() } }