From 4d452ab5b079d6ff595ed5c137bc25f7810ef261 Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Mon, 13 Oct 2025 14:01:47 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(cli):=20use=20Gma?= =?UTF-8?q?ilClient=20instead=20of=20credential=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - use GmailClient to reduce redundant credential file passing --- src/cli/trash_cli.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/cli/trash_cli.rs b/src/cli/trash_cli.rs index dbe5461..71eb9b7 100644 --- a/src/cli/trash_cli.rs +++ b/src/cli/trash_cli.rs @@ -1,5 +1,5 @@ use clap::Parser; -use cull_gmail::{Error, Trash}; +use cull_gmail::{Error, GmailClient, Trash}; /// Command line options for the list subcommand #[derive(Debug, Parser)] @@ -19,14 +19,12 @@ pub struct TrashCli { } impl TrashCli { - pub(crate) async fn run(&self, credential_file: &str) -> Result<(), Error> { - let mut list = Trash::new(credential_file).await?; + pub(crate) async fn run(&self, client: &GmailClient) -> Result<(), Error> { + let mut list = Trash::new(client).await?; if !self.labels.is_empty() { // add labels if any specified - list.message_list() - .add_labels(credential_file, &self.labels) - .await?; + list.message_list().add_labels(client, &self.labels).await?; } if let Some(query) = self.query.as_ref() {