From 50335ca38e9bae9119d474a600d616fe0ade0a76 Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Sat, 25 Oct 2025 22:46:00 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(cli):=20prevent=20dry-run=20?= =?UTF-8?q?from=20crashing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - prevent dry-run crashing by calling log messages function --- src/cli/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cli/main.rs b/src/cli/main.rs index 6fd60b1..92c8caf 100644 --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -118,7 +118,7 @@ mod rules_cli; mod token_cli; use config::Config; -use cull_gmail::{ClientConfig, EolAction, GmailClient, Result, RuleProcessor, Rules}; +use cull_gmail::{ClientConfig, EolAction, GmailClient, MessageList, Result, RuleProcessor, Rules}; use std::{env, error::Error as stdError}; use init_cli::InitCli; @@ -511,6 +511,7 @@ async fn run_rules(client: &mut GmailClient, rules: Rules, execute: bool) -> Res if execute { execute_action(action, client, &label).await; } else { + client.log_messages("", "").await?; log::warn!("Execution stopped for dry run"); } } @@ -625,7 +626,7 @@ fn get_rules_path(config: &Config) -> Result> { /// /// This function should only be called when execute mode is enabled and after /// appropriate user confirmation for destructive operations. -async fn execute_action(action: EolAction, client: &GmailClient, label: &str) { +async fn execute_action(action: EolAction, client: &mut GmailClient, label: &str) { match action { EolAction::Trash => { log::info!("***executing trash messages***");