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

@@ -60,7 +60,13 @@ use cull_gmail::{ClientConfig, Error, GmailClient, Result};
use lazy_regex::{Lazy, Regex, lazy_regex};
/// Parse configuration root path with h:, c:, r: prefixes.
fn parse_config_root(path_str: &str) -> PathBuf {
///
/// Supports:
/// - `h:path` - Relative to home directory
/// - `c:path` - Relative to current directory
/// - `r:path` - Relative to filesystem root
/// - `path` - Use path as-is
pub fn parse_config_root(path_str: &str) -> PathBuf {
static ROOT_CONFIG: Lazy<Regex> = lazy_regex!(r"^(?P<class>[hrc]):(?P<path>.+)$");
if let Some(captures) = ROOT_CONFIG.captures(path_str) {