From 6bafe4cd66ef89b309da4c6b280a56c41a56e74e Mon Sep 17 00:00:00 2001 From: AppleTheGolden Date: Tue, 31 Dec 2019 00:46:02 +0100 Subject: [PATCH] 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. --- src/configure.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/configure.rs b/src/configure.rs index b8e3812c..c3cf9877 100644 --- a/src/configure.rs +++ b/src/configure.rs @@ -40,11 +40,16 @@ fn get_editor_internal(visual: Option, editor: Option) -> 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)]