🐛 fix(remove_cli): handle rule not found when removing label
- return error if rule not found when removing label
This commit is contained in:
committed by
Jeremiah Russell
parent
66dd0dc983
commit
95e19884a2
@@ -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 RemoveCli {
|
pub struct RemoveCli {
|
||||||
@@ -13,7 +13,11 @@ pub struct RemoveCli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RemoveCli {
|
impl RemoveCli {
|
||||||
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.remove_label_from_rule(self.id, &self.label)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user