lib/battery: rename `plugin/battery`

This plugin *only* provides utility functions, so it has zero cost to just being enabled. This allows us to eliminate assumptions from `lib/theme` and several themes.
pull/2085/head
John D Pell 2022-02-08 16:17:46 -08:00
parent 4dbe92e38d
commit 8ef853cf57
6 changed files with 5 additions and 38 deletions

View File

@ -81,6 +81,7 @@ completion/available/vuejs.completion.bash
completion/available/wpscan.completion.bash
# libraries
lib/battery.bash
lib/colors.bash
lib/helpers.bash
lib/log.bash
@ -94,7 +95,6 @@ plugins/available/alias-completion.plugin.bash
plugins/available/autojump.plugin.bash
plugins/available/base.plugin.bash
plugins/available/basher.plugin.bash
plugins/available/battery.plugin.bash
plugins/available/blesh.plugin.bash
plugins/available/cmd-returned-notify.plugin.bash
plugins/available/colors.plugin.bash

View File

@ -558,23 +558,6 @@ function battery_char {
fi
}
if ! _command_exists battery_charge; then
# if user has installed battery plugin, skip this...
function battery_charge() {
# no op
echo -n
}
fi
# The battery_char function depends on the presence of the battery_percentage function.
# If battery_percentage is not defined, then define battery_char as a no-op.
if ! _command_exists battery_percentage; then
function battery_char() {
# no op
echo -n
}
fi
function aws_profile {
if [[ $AWS_DEFAULT_PROFILE ]]; then
echo -e "${AWS_DEFAULT_PROFILE}"

View File

@ -82,14 +82,6 @@ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}"
fi
}
# checks if the plugin is installed before calling battery_charge
safe_battery_charge() {
if _command_exists battery_charge ;
then
battery_charge
fi
}
# -------------------------------------------------------------- PROMPT OUTPUT
prompt() {
local LAST_COMMAND_FAILED=$(mitsuhikos_lastcommandfailed)
@ -101,7 +93,7 @@ prompt() {
if [[ "$OSTYPE" = 'linux'* ]]
then
PS1="${TITLEBAR}${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}
$(safe_battery_charge)${RESTORE_CURSOR}\
$(battery_charge)${RESTORE_CURSOR}\
${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\
at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\
in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\
@ -117,7 +109,7 @@ in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\
${LAST_COMMAND_FAILED}\
$(demula_vcprompt)\
$(is_vim_shell)\
$(safe_battery_charge)
$(battery_charge)
${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
fi

View File

@ -115,14 +115,6 @@ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}"
fi
}
# checks if the plugin is installed before calling battery_charge
safe_battery_charge() {
if _command_exists battery_charge ;
then
battery_charge
fi
}
prompt_git() {
local s='';
local branchName='';
@ -185,7 +177,7 @@ prompt() {
then
PS1="${TITLEBAR}
${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\
$(safe_battery_charge)${RESTORE_CURSOR}\
$(battery_charge)${RESTORE_CURSOR}\
${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\
at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\
in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\
@ -203,7 +195,7 @@ $(prompt_git "$D_INTERMEDIATE_COLOR on $D_GIT_COLOR")\
${LAST_COMMAND_FAILED}\
$(demula_vcprompt)\
$(is_vim_shell)\
$(safe_battery_charge)
$(battery_charge)
${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
fi