feat: update config system and list format structure

Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-16 11:57:02 -03:00
parent e1091b72f8
commit b90456c6f4
4 changed files with 167 additions and 170 deletions

View File

@@ -51,30 +51,16 @@ fn main() -> Result<(), Error> {
debug!("MAIN: Start");
// Load configuration with priority: CLI args > env vars > config file > defaults
let config_path = if let Some(config_path) = &args.options.config {
config_path.clone()
} else if let Ok(env_config) = std::env::var("KEEP_CONFIG") {
PathBuf::from(env_config)
} else {
Config::default_config_path().unwrap_or_else(|_| PathBuf::from("~/.config/keep/config.yml"))
};
let mut config = Config::from_file(&config_path).unwrap_or_else(|e| {
debug!("CONFIG: Failed to load config: {}, using defaults", e);
Config::default()
});
debug!("MAIN: Loaded config: {:?}", config);
// Determine default data directory
let default_dir = match proj_dirs {
Some(ref proj_dirs) => proj_dirs.data_dir().to_path_buf(),
None => return Err(anyhow!("Unable to determine data directory")),
};
// Create unified settings
let settings = Settings::from_config_and_args(&config, &args, default_dir)?;
// Create unified settings using the new config system
let settings = Settings::new(&args, default_dir)?;
debug!("MAIN: Loaded settings: {:?}", settings);
let ids = &mut Vec::new();
let tags = &mut Vec::new();