pub struct ConfigLoader { /* private fields */ }Expand description
Configuration loader with caching and inheritance support.
Implementations§
Source§impl ConfigLoader
impl ConfigLoader
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new configuration loader.
Automatically detects the global config directory (~/.codeprysm).
Sourcepub fn with_global_dir(global_dir: impl Into<PathBuf>) -> Self
pub fn with_global_dir(global_dir: impl Into<PathBuf>) -> Self
Create a loader with a custom global config directory.
Useful for testing.
Sourcepub fn global_config_path(&self) -> Option<PathBuf>
pub fn global_config_path(&self) -> Option<PathBuf>
Get the global config file path.
Sourcepub fn local_config_path(&self, workspace_root: &Path) -> PathBuf
pub fn local_config_path(&self, workspace_root: &Path) -> PathBuf
Get the local config file path for a workspace.
Sourcepub fn load(
&mut self,
workspace_root: &Path,
overrides: Option<&ConfigOverrides>,
) -> Result<PrismConfig, ConfigError>
pub fn load( &mut self, workspace_root: &Path, overrides: Option<&ConfigOverrides>, ) -> Result<PrismConfig, ConfigError>
Load configuration for a workspace with optional CLI overrides.
Merges config in order: global → local → overrides.
Sourcepub fn load_global(&mut self) -> Result<Option<PrismConfig>, ConfigError>
pub fn load_global(&mut self) -> Result<Option<PrismConfig>, ConfigError>
Load only the global configuration.
Sourcepub fn load_local(
&self,
workspace_root: &Path,
) -> Result<Option<PrismConfig>, ConfigError>
pub fn load_local( &self, workspace_root: &Path, ) -> Result<Option<PrismConfig>, ConfigError>
Load only the local configuration for a workspace.
Sourcepub fn save_global(&self, config: &PrismConfig) -> Result<(), ConfigError>
pub fn save_global(&self, config: &PrismConfig) -> Result<(), ConfigError>
Save configuration to the global config file.
Sourcepub fn save_local(
&self,
workspace_root: &Path,
config: &PrismConfig,
) -> Result<(), ConfigError>
pub fn save_local( &self, workspace_root: &Path, config: &PrismConfig, ) -> Result<(), ConfigError>
Save configuration to the local config file for a workspace.
Sourcepub fn init_global(&self) -> Result<PathBuf, ConfigError>
pub fn init_global(&self) -> Result<PathBuf, ConfigError>
Initialize global configuration directory.
Creates ~/.codeprysm/config.toml with default configuration.
Sourcepub fn init_local(&self, workspace_root: &Path) -> Result<PathBuf, ConfigError>
pub fn init_local(&self, workspace_root: &Path) -> Result<PathBuf, ConfigError>
Initialize local configuration for a workspace.
Creates .codeprysm/config.toml with default configuration.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear cached global configuration.
Forces reload on next load_global() call.
Trait Implementations§
Source§impl Clone for ConfigLoader
impl Clone for ConfigLoader
Source§fn clone(&self) -> ConfigLoader
fn clone(&self) -> ConfigLoader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more