From 21942f627573d89f33b9e64604c4fe9df305aecf Mon Sep 17 00:00:00 2001 From: John D Pell Date: Wed, 12 Jan 2022 21:59:40 -0800 Subject: [PATCH 1/2] lib/theme: disable THEME_CHECK_SUDO Move `$THEME_CHECK_SUDO` to `lib/them`, and set it to `false` instead of `true`. --- themes/base.theme.bash | 4 +++- themes/gitline/powerline.base.bash | 2 -- themes/powerline/powerline.base.bash | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 94e6befd..9e4a2562 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -26,7 +26,9 @@ SCM_THEME_CURRENT_USER_SUFFIX='' SCM_THEME_CHAR_PREFIX='' SCM_THEME_CHAR_SUFFIX='' -THEME_BATTERY_PERCENTAGE_CHECK=${THEME_BATTERY_PERCENTAGE_CHECK:=true} +# Define this here so it can be used by all of the themes +: "${THEME_CHECK_SUDO:=false}" +: "${THEME_BATTERY_PERCENTAGE_CHECK:=true}" SCM_GIT_SHOW_DETAILS=${SCM_GIT_SHOW_DETAILS:=true} SCM_GIT_SHOW_REMOTE_INFO=${SCM_GIT_SHOW_REMOTE_INFO:=auto} diff --git a/themes/gitline/powerline.base.bash b/themes/gitline/powerline.base.bash index 4f6b17b0..7f6f3130 100644 --- a/themes/gitline/powerline.base.bash +++ b/themes/gitline/powerline.base.bash @@ -1,5 +1,3 @@ -# Sudo check after every command -THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true} #To set color for foreground and background function set_color { diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 85ad4c2b..84469e87 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -1,9 +1,6 @@ # shellcheck shell=bash # shellcheck disable=SC2034 # Expected behavior for themes. -# Define this here so it can be used by all of the Powerline themes -THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true} - function set_color() { local fg='' bg='' if [[ "${1:-}" != "-" ]]; then From 18536ed892fd90df81470710ea5a6a88c5eeec01 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Wed, 12 Jan 2022 22:08:54 -0800 Subject: [PATCH 2/2] template: Add `$THEME_CHECK_SUDO` --- template/bash_profile.template.bash | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index 75febdab..378950d9 100755 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -14,6 +14,10 @@ export BASH_IT="{{BASH_IT}}" # location /.bash_it/themes/ export BASH_IT_THEME='bobby' +# Some themes can show whether `sudo` has a current token or not. +# Set `$THEME_CHECK_SUDO` to `true` to check every prompt: +#THEME_CHECK_SUDO='true' + # (Advanced): Change this to the name of your remote repo if you # cloned bash-it with a remote other than origin such as `bash-it`. # export BASH_IT_REMOTE='bash-it'