Copied command_exists function to the helpers lib so that there is no hidden dependency on the base plugin
The original command_exists function will stay in the base plugin, but will no longer be used by other plugins or themes.
This commit is contained in:
@@ -164,7 +164,7 @@ ___atomic_prompt_clock() {
|
||||
}
|
||||
|
||||
___atomic_prompt_battery() {
|
||||
! command_exists battery_percentage ||
|
||||
! _command_exists battery_percentage ||
|
||||
[ "${THEME_SHOW_BATTERY}" != "true" ] ||
|
||||
[ "$(battery_percentage)" = "no" ] && return
|
||||
|
||||
|
||||
@@ -474,7 +474,7 @@ function battery_char {
|
||||
fi
|
||||
}
|
||||
|
||||
if ! command_exists battery_charge ; then
|
||||
if ! _command_exists battery_charge ; then
|
||||
# if user has installed battery plugin, skip this...
|
||||
function battery_charge (){
|
||||
# no op
|
||||
@@ -484,7 +484,7 @@ 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
|
||||
if ! _command_exists battery_percentage ; then
|
||||
function battery_char (){
|
||||
# no op
|
||||
echo -n
|
||||
|
||||
@@ -152,7 +152,7 @@ ___brainy_prompt_clock() {
|
||||
}
|
||||
|
||||
___brainy_prompt_battery() {
|
||||
! command_exists battery_percentage ||
|
||||
! _command_exists battery_percentage ||
|
||||
[ "${THEME_SHOW_BATTERY}" != "true" ] ||
|
||||
[ "$(battery_percentage)" = "no" ] && return
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}"
|
||||
|
||||
# checks if the plugin is installed before calling battery_charge
|
||||
safe_battery_charge() {
|
||||
if command_exists battery_charge ;
|
||||
if _command_exists battery_charge ;
|
||||
then
|
||||
battery_charge
|
||||
fi
|
||||
|
||||
@@ -43,9 +43,9 @@ function __powerline_user_info_prompt {
|
||||
function __powerline_ruby_prompt {
|
||||
local ruby_version=""
|
||||
|
||||
if command_exists rvm; then
|
||||
if _command_exists rvm; then
|
||||
ruby_version="$(rvm_version_prompt)"
|
||||
elif command_exists rbenv; then
|
||||
elif _command_exists rbenv; then
|
||||
ruby_version=$(rbenv_version_prompt)
|
||||
fi
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}"
|
||||
|
||||
# checks if the plugin is installed before calling battery_charge
|
||||
safe_battery_charge() {
|
||||
if command_exists battery_charge ;
|
||||
if _command_exists battery_charge ;
|
||||
then
|
||||
battery_charge
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user