🐛 fix(remove_cli): handle rule not found when removing label

- return error if rule not found when removing label
This commit is contained in:
Jeremiah Russell
2025-10-09 12:24:39 +01:00
committed by Jeremiah Russell
parent 66dd0dc983
commit 95e19884a2

View File

@@ -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)
}
}