fix: error when default config file already exists

This commit is contained in:
Joshua Lane
2025-01-12 12:26:45 -08:00
parent 563ae3908e
commit b8eafd5fa2

View File

@@ -144,6 +144,10 @@ impl Args {
let config_path = shellexpand::tilde(&self.config_file).into_owned();
let path = PathBuf::from(config_path);
if path.exists() {
return Err(anyhow!("Config file `{}` already exists", path.display()));
}
if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent)?;
}