From cfd33540aae40fa1754c6af9b4ae9a795e5bca6f Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Mon, 13 Oct 2025 14:00:42 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(cli):=20use=20gma?= =?UTF-8?q?il=20client=20in=20run=5Fcli?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - use gmail client in `run_cli` to avoid passing credentials around --- src/cli/run_cli.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cli/run_cli.rs b/src/cli/run_cli.rs index 01cc7bd..3c795d7 100644 --- a/src/cli/run_cli.rs +++ b/src/cli/run_cli.rs @@ -1,5 +1,5 @@ use clap::Parser; -use cull_gmail::{Config, EolAction, Processor, Result}; +use cull_gmail::{Config, EolAction, GmailClient, Processor, Result}; #[derive(Debug, Parser)] pub struct RunCli { @@ -15,7 +15,7 @@ pub struct RunCli { } impl RunCli { - pub async fn run(&self, config: Config) -> Result<()> { + pub async fn run(&self, client: &GmailClient, config: Config) -> Result<()> { let rules = config.get_rules_by_label(); for label in config.labels() { @@ -26,7 +26,7 @@ impl RunCli { log::info!("Executing rule `#{}` for label `{label}`", rule.describe()); - let mut builder = Processor::builder(config.credential_file(), rule); + let mut builder = Processor::builder(client, rule); let processor = builder.set_execute(self.execute).build(); let Some(action) = processor.action() else {