🐛 fix(label_cli): fix add label logic
- correct logic for adding label to rule
This commit is contained in:
committed by
Jeremiah Russell
parent
d6ee9f5227
commit
1ff33bba3f
@@ -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 AddCli {
|
pub struct AddCli {
|
||||||
@@ -13,7 +13,11 @@ pub struct AddCli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl AddCli {
|
impl AddCli {
|
||||||
pub fn run(&self, _config: Config) -> Result<()> {
|
pub fn run(&self, mut config: Config) -> Result<()> {
|
||||||
Ok(())
|
if config.get_rule(self.id).is_none() {
|
||||||
|
return Err(Error::RuleNotFound(self.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
config.add_label_to_rule(self.id, &self.label)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user