From 95e19884a2186e3aa13c8efa2d9981120febe7b3 Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Thu, 9 Oct 2025 12:24:39 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(remove=5Fcli):=20handle=20ru?= =?UTF-8?q?le=20not=20found=20when=20removing=20label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - return error if rule not found when removing label --- src/config_cli/label_cli/remove_cli.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/config_cli/label_cli/remove_cli.rs b/src/config_cli/label_cli/remove_cli.rs index e06cdec..c80843e 100644 --- a/src/config_cli/label_cli/remove_cli.rs +++ b/src/config_cli/label_cli/remove_cli.rs @@ -1,6 +1,6 @@ use clap::Parser; -use cull_gmail::{Config, Result}; +use cull_gmail::{Config, Error, Result}; #[derive(Debug, Parser)] pub struct RemoveCli { @@ -13,7 +13,11 @@ pub struct RemoveCli { } impl RemoveCli { - pub fn run(&self, _config: Config) -> Result<()> { - Ok(()) + pub fn run(&self, mut config: Config) -> Result<()> { + if config.get_rule(self.id).is_none() { + return Err(Error::RuleNotFound(self.id)); + } + + config.remove_label_from_rule(self.id, &self.label) } }