🐛 fix(label_cli): display labels by rule id

- fix label listing to correctly display labels associated with a specified rule ID
This commit is contained in:
Jeremiah Russell
2025-10-09 08:12:41 +01:00
committed by Jeremiah Russell
parent 1132a2da3c
commit ee3c43e54d

View File

@@ -1,6 +1,6 @@
use clap::Parser; use clap::Parser;
use cull_gmail::{Config, Result}; use cull_gmail::{Config, Error, Result};
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
pub struct ListCli { pub struct ListCli {
@@ -10,7 +10,15 @@ pub struct ListCli {
} }
impl ListCli { impl ListCli {
pub fn run(&self, _config: Config) -> Result<()> { pub fn run(&self, config: Config) -> Result<()> {
let Some(rule) = config.get_rule(self.id) else {
return Err(Error::RuleNotFound(self.id));
};
for label in rule.labels() {
log::info!("Label in rule: `{label}`");
}
Ok(()) Ok(())
} }
} }