♻️ refactor(cli): remove config from run args

- remove config from run args to load inside functions
- load credential.json directly instead of config file
This commit is contained in:
Jeremiah Russell
2025-10-15 13:47:25 +01:00
committed by Jeremiah Russell
parent 455007dd82
commit 5905a6fb54
4 changed files with 27 additions and 16 deletions

View File

@@ -15,11 +15,11 @@ pub struct RunCli {
}
impl RunCli {
pub async fn run(&self, client: &mut GmailClient, config: Rules) -> Result<()> {
let rules = config.get_rules_by_label();
pub async fn run(&self, client: &mut GmailClient, rules: Rules) -> Result<()> {
let rules_by_labels = rules.get_rules_by_label();
for label in config.labels() {
let Some(rule) = rules.get(&label) else {
for label in rules.labels() {
let Some(rule) = rules_by_labels.get(&label) else {
log::warn!("no rule found for label `{label}`");
continue;
};