From d7aebe17a391331485021826603e08908ee13c2e Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 21 Jun 2020 14:10:14 +0300 Subject: [PATCH] plugins: Rename SCM_GIT_GITSTATUS_PLUGIN_SH_LOC to SCM_GIT_GITSTATUS_DIR Also fix the destructor in case plugin did not load as expected --- plugins/available/gitstatus.plugin.bash | 8 ++++---- template/bash_profile.template.bash | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/available/gitstatus.plugin.bash b/plugins/available/gitstatus.plugin.bash index d48d0569..8e6558cd 100644 --- a/plugins/available/gitstatus.plugin.bash +++ b/plugins/available/gitstatus.plugin.bash @@ -7,16 +7,16 @@ function gitstatus_on_disable() { group 'gitstatus' unset SCM_GIT_USE_GITSTATUS - gitstatus_stop + _command_exists gitstatus_stop && gitstatus_stop } [[ "$SCM_CHECK" == "true" ]] || return # No scm-check [[ $- == *i* ]] || return # non-interactive shell -SCM_GIT_GITSTATUS_PLUGIN_SH_LOC=${SCM_GIT_GITSTATUS_PLUGIN_SH_LOC:="$HOME/gitstatus/gitstatus.plugin.sh"} -if [[ -f "${SCM_GIT_GITSTATUS_PLUGIN_SH_LOC}" ]]; then - source "${SCM_GIT_GITSTATUS_PLUGIN_SH_LOC}" +: ${SCM_GIT_GITSTATUS_DIR:="$HOME/gitstatus"} +if [[ -d "${SCM_GIT_GITSTATUS_DIR}" ]]; then + source "${SCM_GIT_GITSTATUS_DIR}/gitstatus.plugin.sh" # Start the actual gitstatus binary gitstatus_stop && gitstatus_start -s -1 -u -1 -c -1 -d -1 export SCM_GIT_USE_GITSTATUS=true diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index 40ac5c32..f8f4705f 100755 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -32,8 +32,8 @@ export TODO="t" # Set this to false to turn off version control status checking within the prompt for all themes export SCM_CHECK=true -# Set to actual location of gitstatus.plugin.sh if installed -#export SCM_GIT_GITSTATUS_PLUGIN_SH_LOC="$HOME/gitstatus/gitstatus.plugin.sh" +# Set to actual location of gitstatus directory if installed +#export SCM_GIT_GITSTATUS_DIR="$HOME/gitstatus" # per default gitstatus uses 2 times as many threads as CPU cores, you can change this here if you must #export GITSTATUS_NUM_THREADS=8