fix(config): watch/update config given with --config when appropriate (#3678)

This commit is contained in:
Aram Drevekenin 2024-10-14 18:01:11 +02:00 committed by GitHub
parent 4c6e1b6564
commit 0997a0035d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -238,10 +238,12 @@ impl Config {
Ok(()) Ok(())
} }
pub fn config_file_path(opts: &CliArgs) -> Option<PathBuf> { pub fn config_file_path(opts: &CliArgs) -> Option<PathBuf> {
opts.config.clone().or_else(|| {
opts.config_dir opts.config_dir
.clone() .clone()
.or_else(home::find_default_config_dir) .or_else(home::find_default_config_dir)
.map(|config_dir| config_dir.join(DEFAULT_CONFIG_FILE_NAME)) .map(|config_dir| config_dir.join(DEFAULT_CONFIG_FILE_NAME))
})
} }
pub fn write_config_to_disk(config: String, opts: &CliArgs) -> Result<Config, Option<PathBuf>> { pub fn write_config_to_disk(config: String, opts: &CliArgs) -> Result<Config, Option<PathBuf>> {
// if we fail, try to return the PathBuf of the file we were not able to write to // if we fail, try to return the PathBuf of the file we were not able to write to