Run code fomatter for themes/base.theme.bash

pull/1785/head
Marcos Pereira 2021-01-11 15:13:01 -05:00
parent 3f29862478
commit 5a761b7ae3
No known key found for this signature in database
GPG Key ID: F7EBB0FF122A3D87
1 changed files with 336 additions and 322 deletions

View File

@ -92,33 +92,47 @@ SVN_EXE=$(which svn 2> /dev/null || true)
# Check for broken SVN exe that is caused by some versions of Xcode.
# See https://github.com/Bash-it/bash-it/issues/1612 for more details.
if [[ -x "$SVN_EXE" ]] ; then
if ! "$SVN_EXE" --version > /dev/null 2>&1 ; then
if [[ -x "$SVN_EXE" ]]; then
if ! "$SVN_EXE" --version > /dev/null 2>&1; then
# Unset the SVN exe variable so that SVN commands are avoided.
SVN_EXE=""
fi
fi
function scm {
if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE
elif [[ -f .git/HEAD ]] && [[ -x "$GIT_EXE" ]]; then SCM=$SCM_GIT
elif [[ -x "$GIT_EXE" ]] && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then SCM=$SCM_GIT
elif [[ -x "$P4_EXE" ]] && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then SCM=$SCM_P4
elif [[ -d .hg ]] && [[ -x "$HG_EXE" ]]; then SCM=$SCM_HG
elif [[ -x "$HG_EXE" ]] && [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$SCM_HG
elif [[ -d .svn ]] && [[ -x "$SVN_EXE" ]]; then SCM=$SCM_SVN
elif [[ -x "$SVN_EXE" ]] && [[ -n "$(svn info --show-item wc-root 2>/dev/null)" ]]; then SCM=$SCM_SVN
else SCM=$SCM_NONE
if [[ "$SCM_CHECK" = false ]]; then
SCM=$SCM_NONE
elif [[ -f .git/HEAD ]] && [[ -x "$GIT_EXE" ]]; then
SCM=$SCM_GIT
elif [[ -x "$GIT_EXE" ]] && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then
SCM=$SCM_GIT
elif [[ -x "$P4_EXE" ]] && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then
SCM=$SCM_P4
elif [[ -d .hg ]] && [[ -x "$HG_EXE" ]]; then
SCM=$SCM_HG
elif [[ -x "$HG_EXE" ]] && [[ -n "$(hg root 2> /dev/null)" ]]; then
SCM=$SCM_HG
elif [[ -d .svn ]] && [[ -x "$SVN_EXE" ]]; then
SCM=$SCM_SVN
elif [[ -x "$SVN_EXE" ]] && [[ -n "$(svn info --show-item wc-root 2> /dev/null)" ]]; then
SCM=$SCM_SVN
else
SCM=$SCM_NONE
fi
}
function scm_prompt_char {
if [[ -z $SCM ]]; then scm; fi
if [[ $SCM == $SCM_GIT ]]; then SCM_CHAR=$SCM_GIT_CHAR
elif [[ $SCM == $SCM_P4 ]]; then SCM_CHAR=$SCM_P4_CHAR
elif [[ $SCM == $SCM_HG ]]; then SCM_CHAR=$SCM_HG_CHAR
elif [[ $SCM == $SCM_SVN ]]; then SCM_CHAR=$SCM_SVN_CHAR
else SCM_CHAR=$SCM_NONE_CHAR
if [[ $SCM == $SCM_GIT ]]; then
SCM_CHAR=$SCM_GIT_CHAR
elif [[ $SCM == $SCM_P4 ]]; then
SCM_CHAR=$SCM_P4_CHAR
elif [[ $SCM == $SCM_HG ]]; then
SCM_CHAR=$SCM_HG_CHAR
elif [[ $SCM == $SCM_SVN ]]; then
SCM_CHAR=$SCM_SVN_CHAR
else
SCM_CHAR=$SCM_NONE_CHAR
fi
}
@ -167,9 +181,9 @@ function scm_prompt_info_common {
}
function terraform_workspace_prompt {
if _command_exists terraform ; then
if _command_exists terraform; then
if [ -d .terraform ]; then
echo -e "$(terraform workspace show 2>/dev/null)"
echo -e "$(terraform workspace show 2> /dev/null)"
fi
fi
}
@ -265,7 +279,7 @@ function git_prompt_vars {
SCM_PREFIX=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX}
SCM_SUFFIX=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX}
SCM_CHANGE=$(_git-short-sha 2>/dev/null || echo "")
SCM_CHANGE=$(_git-short-sha 2> /dev/null || echo "")
}
function p4_prompt_vars {
@ -289,7 +303,7 @@ function p4_prompt_vars {
}
function svn_prompt_vars {
if [[ -n $(svn status |head -c1 2> /dev/null) ]]; then
if [[ -n $(svn status | head -c1 2> /dev/null) ]]; then
SCM_DIRTY=1
SCM_STATE=${SVN_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
else
@ -415,7 +429,7 @@ function k8s_context_prompt {
function virtualenv_prompt {
if [[ -n "$VIRTUAL_ENV" ]]; then
virtualenv=`basename "$VIRTUAL_ENV"`
virtualenv=$(basename "$VIRTUAL_ENV")
echo -e "$VIRTUALENV_THEME_PROMPT_PREFIX$virtualenv$VIRTUALENV_THEME_PROMPT_SUFFIX"
fi
}
@ -508,9 +522,9 @@ 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 (){
function battery_charge() {
# no op
echo -n
}
@ -518,8 +532,8 @@ 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 (){
if ! _command_exists battery_percentage; then
function battery_char() {
# no op
echo -n
}
@ -548,7 +562,7 @@ function safe_append_prompt_command {
if [ "${__bp_imported}" == "defined" ]; then
# We are using bash-preexec
if ! __check_precmd_conflict "${1}" ; then
if ! __check_precmd_conflict "${1}"; then
precmd_functions+=("${1}")
fi
else