mirror of
https://github.com/starship/starship
synced 2024-11-02 14:53:45 +00:00
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
1 changed files with 10 additions and 5 deletions
|
@ -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)]
|
||||
|
|
Loading…
Reference in a new issue