✨ 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:
committed by
Jeremiah Russell
parent
20b36a00ed
commit
bcb93fd68f
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user