🐛 fix(label_cli): fix add label logic

- correct logic for adding label to rule
This commit is contained in:
Jeremiah Russell
2025-10-09 11:14:33 +01:00
committed by Jeremiah Russell
parent d6ee9f5227
commit 1ff33bba3f

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 AddCli {
@@ -13,7 +13,11 @@ pub struct AddCli {
}
impl AddCli {
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.add_label_to_rule(self.id, &self.label)
}
}