use super::merge::service::MergeService;
use super::MerkleConfig;
use config::ConfigError;
use std::path::Path;
#[cfg(test)]
use std::path::PathBuf;
pub struct ConfigLoader;
impl ConfigLoader {
#[cfg(test)]
pub(crate) fn xdg_config_path() -> Option<PathBuf> {
std::env::var("HOME").ok().map(|home| {
PathBuf::from(home)
.join(".config")
.join("meld")
.join("config.toml")
})
}
pub fn load(workspace_root: &Path) -> Result<MerkleConfig, ConfigError> {
MergeService::load(workspace_root)
}
pub fn load_from_file(path: &Path) -> Result<MerkleConfig, ConfigError> {
MergeService::load_from_file(path)
}
pub fn default() -> MerkleConfig {
MerkleConfig::default()
}
}