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:
AppleTheGolden 2019-12-31 00:46:02 +01:00 committed by Kevin Song
parent a8e20ef387
commit 6bafe4cd66

View file

@ -40,11 +40,16 @@ fn get_editor_internal(visual: Option<OsString>, editor: Option<OsString>) -> Os
}
fn get_config_path() -> OsString {
dirs::home_dir()
.expect("Couldn't find home directory")
.join(".config/starship.toml")
.as_os_str()
.to_owned()
let config_path = env::var_os("STARSHIP_CONFIG").unwrap_or_else(|| "".into());
if config_path.is_empty() {
dirs::home_dir()
.expect("couldn't find home directory")
.join(".config/starship.toml")
.as_os_str()
.to_owned()
} else {
config_path
}
}
#[cfg(test)]