From bf8d1c3cf4608447515b3cc92b94c07bd4d8a4e6 Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Fri, 31 Oct 2025 08:01:34 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(cli):=20add=20optional=20rules?= =?UTF-8?q?=20path=20argument=20to=20cli?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - allow users to specify a rules file path via command line argument - update run_with_rules_path to prioritize cli argument over config file --- src/cli/rules_cli.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cli/rules_cli.rs b/src/cli/rules_cli.rs index 4cd765d..2128740 100644 --- a/src/cli/rules_cli.rs +++ b/src/cli/rules_cli.rs @@ -102,7 +102,7 @@ //! - **Logging system**: Comprehensive operation tracking use clap::{Parser, Subcommand}; -use std::path::Path; +use std::path::{Path, PathBuf}; mod config_cli; mod run_cli; @@ -210,6 +210,7 @@ pub struct RulesCli { /// Each subcommand provides specialized functionality for its domain. #[command(subcommand)] sub_command: SubCmds, + rules: Option, } impl RulesCli { @@ -275,8 +276,14 @@ impl RulesCli { pub async fn run_with_rules_path( &self, client: &mut GmailClient, - rules_path: Option<&Path>, + mut rules_path: Option<&Path>, ) -> Result<()> { + log::info!("Rules path: {rules_path:?}"); + if let Some(p) = &self.rules { + rules_path = Some(p.as_path()); + } + log::info!("Rules path: {rules_path:?}"); + let rules = get_rules_from(rules_path)?; match &self.sub_command {