feat: integrate configurable rules path throughout CLI

- Make parse_config_root() public for reuse in main.rs
- Add get_rules_path() helper to extract and resolve rules path from config
- Update main CLI to use configured rules path for default rule execution
- Add run_with_rules_path() method to RulesCli for custom path support
- Update all unit tests to include rules_dir field
- Rules path now supports h:, c:, r: prefixes throughout the application
This commit is contained in:
Jeremiah Russell
2025-10-21 17:52:23 +01:00
committed by Jeremiah Russell
parent 20b36a00ed
commit bcb93fd68f
4 changed files with 69 additions and 4 deletions

View File

@@ -263,7 +263,21 @@ impl RulesCli {
/// - **Error isolation**: Subcommand errors don't affect rule loading
/// - **State preservation**: Configuration errors don't corrupt existing rules
pub async fn run(&self, client: &mut GmailClient) -> Result<()> {
let rules = get_rules()?;
self.run_with_rules_path(client, None).await
}
/// Executes the rules command with an optional custom rules path.
///
/// # Arguments
///
/// * `client` - Mutable Gmail client for API operations
/// * `rules_path` - Optional path to rules file
pub async fn run_with_rules_path(
&self,
client: &mut GmailClient,
rules_path: Option<&Path>,
) -> Result<()> {
let rules = get_rules_from(rules_path)?;
match &self.sub_command {
SubCmds::Config(config_cli) => config_cli.run(rules),