From d7912f8f1b870cf1854fe1e95aa39f85430d0daa Mon Sep 17 00:00:00 2001 From: Ben Brunton Date: Wed, 12 Nov 2014 17:27:38 +0000 Subject: [PATCH 1/2] prevent battery_charge call from erroring in themes when battery plugin not enabled --- themes/base.theme.bash | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index e5e6fceb..364f734d 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -216,3 +216,12 @@ function scm_char { function prompt_char { scm_char } + +if [ ! -e $BASH_IT/plugins/enabled/battery.plugin.bash ]; then +# if user has installed battery plugin, skip this... + function battery_charge (){ + # no op + echo -n + } +fi + From 1c83611faa63d50894fa4a607ae0c2c5f639c469 Mon Sep 17 00:00:00 2001 From: Ben Brunton Date: Thu, 13 Nov 2014 09:17:04 +0000 Subject: [PATCH 2/2] updated brunton theme to use battery_charge --- themes/brunton/brunton.theme.bash | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/themes/brunton/brunton.theme.bash b/themes/brunton/brunton.theme.bash index 7c84faec..839ae674 100644 --- a/themes/brunton/brunton.theme.bash +++ b/themes/brunton/brunton.theme.bash @@ -24,15 +24,8 @@ scm_prompt() { fi } -safe_battery_charge() { - if [ -e "${BASH_IT}/plugins/enabled/battery.plugin.bash" ]; - then - battery_charge - fi -} - prompt() { - PS1="${white}${background_blue} \u${normal}${background_blue}@${red}${background_blue}\h ${blue}${background_white} \t ${reset_color}${normal} $(safe_battery_charge) + PS1="${white}${background_blue} \u${normal}${background_blue}@${red}${background_blue}\h ${blue}${background_white} \t ${reset_color}${normal} $(battery_charge) ${bold_black}${background_white} \w ${normal}$(scm_prompt)$(is_vim_shell) ${white}>${normal} "