fix: Consider `$STARSHIP_CONFIG` in `configure` (#795)
Makes starship configure consider the $STARSHIP_CONFIG variable before falling back to the default of ~/.config/starship.toml.
This commit is contained in:
parent
a8e20ef387
commit
6bafe4cd66
|
@ -40,11 +40,16 @@ fn get_editor_internal(visual: Option<OsString>, editor: Option<OsString>) -> Os
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_config_path() -> OsString {
|
fn get_config_path() -> OsString {
|
||||||
dirs::home_dir()
|
let config_path = env::var_os("STARSHIP_CONFIG").unwrap_or_else(|| "".into());
|
||||||
.expect("Couldn't find home directory")
|
if config_path.is_empty() {
|
||||||
.join(".config/starship.toml")
|
dirs::home_dir()
|
||||||
.as_os_str()
|
.expect("couldn't find home directory")
|
||||||
.to_owned()
|
.join(".config/starship.toml")
|
||||||
|
.as_os_str()
|
||||||
|
.to_owned()
|
||||||
|
} else {
|
||||||
|
config_path
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Reference in New Issue