✨ Add configurable rules directory support
- Add rules configuration option to ClientConfig - Support custom rules file paths via config and CLI - Add --rules-dir option to init command - Update Rules struct to accept custom file paths - Add helper functions for rules path resolution - Fix doc comment formatting issues - Add integration tests for custom rules paths
This commit is contained in:
committed by
Jeremiah Russell
parent
e914e492e8
commit
d4cc2621db
12
src/rules.rs
12
src/rules.rs
@@ -45,7 +45,7 @@ use std::{
|
||||
collections::BTreeMap,
|
||||
env,
|
||||
fs::{self, read_to_string},
|
||||
path::{Path, PathBuf},
|
||||
path::Path,
|
||||
};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -524,8 +524,9 @@ impl Rules {
|
||||
let save_path = if let Some(p) = path {
|
||||
p.to_path_buf()
|
||||
} else {
|
||||
let home_dir = env::home_dir()
|
||||
.ok_or_else(|| Error::HomeExpansionFailed("~/.cull-gmail/rules.toml".to_string()))?;
|
||||
let home_dir = env::home_dir().ok_or_else(|| {
|
||||
Error::HomeExpansionFailed("~/.cull-gmail/rules.toml".to_string())
|
||||
})?;
|
||||
home_dir.join(".cull-gmail/rules.toml")
|
||||
};
|
||||
|
||||
@@ -600,8 +601,9 @@ impl Rules {
|
||||
let load_path = if let Some(p) = path {
|
||||
p.to_path_buf()
|
||||
} else {
|
||||
let home_dir = env::home_dir()
|
||||
.ok_or_else(|| Error::HomeExpansionFailed("~/.cull-gmail/rules.toml".to_string()))?;
|
||||
let home_dir = env::home_dir().ok_or_else(|| {
|
||||
Error::HomeExpansionFailed("~/.cull-gmail/rules.toml".to_string())
|
||||
})?;
|
||||
home_dir.join(".cull-gmail/rules.toml")
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user