summaryrefslogtreecommitdiffstats
path: root/src/configure.rs
diff options
context:
space:
mode:
authorAppleTheGolden <scotsbox@protonmail.com>2019-12-31 00:46:02 +0100
committerKevin Song <chipbuster@users.noreply.github.com>2019-12-30 15:46:02 -0800
commit6bafe4cd66ef89b309da4c6b280a56c41a56e74e (patch)
tree4b4191792c7c855eaf276e81a6aab6076f785b84 /src/configure.rs
parenta8e20ef3877257dde6c883ce781ff07b9d0247f0 (diff)
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.
Diffstat (limited to 'src/configure.rs')
-rw-r--r--src/configure.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/configure.rs b/src/configure.rs
index b8e3812c3..c3cf98771 100644
--- a/src/configure.rs
+++ b/src/configure.rs
@@ -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)]