Fixing base theme
parent
4e6a3c5794
commit
5dcb8243b7
|
|
@ -85,15 +85,15 @@ RBENV_THEME_PROMPT_SUFFIX='|'
|
||||||
RBFU_THEME_PROMPT_PREFIX=' |'
|
RBFU_THEME_PROMPT_PREFIX=' |'
|
||||||
RBFU_THEME_PROMPT_SUFFIX='|'
|
RBFU_THEME_PROMPT_SUFFIX='|'
|
||||||
|
|
||||||
GIT_EXE=$(which git 2> /dev/null || true)
|
GIT_EXE=$(which git 2>/dev/null || true)
|
||||||
P4_EXE=$(which p4 2> /dev/null || true)
|
P4_EXE=$(which p4 2>/dev/null || true)
|
||||||
HG_EXE=$(which hg 2> /dev/null || true)
|
HG_EXE=$(which hg 2>/dev/null || true)
|
||||||
SVN_EXE=$(which svn 2> /dev/null || true)
|
SVN_EXE=$(which svn 2>/dev/null || true)
|
||||||
|
|
||||||
# Check for broken SVN exe that is caused by some versions of Xcode.
|
# 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.
|
# See https://github.com/Bash-it/bash-it/issues/1612 for more details.
|
||||||
if [[ -x "$SVN_EXE" ]]; then
|
if [[ -x "$SVN_EXE" ]]; then
|
||||||
if ! "$SVN_EXE" --version > /dev/null 2>&1; then
|
if ! "$SVN_EXE" --version >/dev/null 2>&1; then
|
||||||
# Unset the SVN exe variable so that SVN commands are avoided.
|
# Unset the SVN exe variable so that SVN commands are avoided.
|
||||||
SVN_EXE=""
|
SVN_EXE=""
|
||||||
fi
|
fi
|
||||||
|
|
@ -104,17 +104,17 @@ function scm {
|
||||||
SCM=$SCM_NONE
|
SCM=$SCM_NONE
|
||||||
elif [[ -f .git/HEAD ]] && [[ -x "$GIT_EXE" ]]; then
|
elif [[ -f .git/HEAD ]] && [[ -x "$GIT_EXE" ]]; then
|
||||||
SCM=$SCM_GIT
|
SCM=$SCM_GIT
|
||||||
elif [[ -x "$GIT_EXE" ]] && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then
|
elif [[ -x "$GIT_EXE" ]] && [[ -n "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]]; then
|
||||||
SCM=$SCM_GIT
|
SCM=$SCM_GIT
|
||||||
elif [[ -x "$P4_EXE" ]] && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then
|
elif [[ -x "$P4_EXE" ]] && [[ -n "$(p4 set P4CLIENT 2>/dev/null)" ]]; then
|
||||||
SCM=$SCM_P4
|
SCM=$SCM_P4
|
||||||
elif [[ -d .hg ]] && [[ -x "$HG_EXE" ]]; then
|
elif [[ -d .hg ]] && [[ -x "$HG_EXE" ]]; then
|
||||||
SCM=$SCM_HG
|
SCM=$SCM_HG
|
||||||
elif [[ -x "$HG_EXE" ]] && [[ -n "$(hg root 2> /dev/null)" ]]; then
|
elif [[ -x "$HG_EXE" ]] && [[ -n "$(hg root 2>/dev/null)" ]]; then
|
||||||
SCM=$SCM_HG
|
SCM=$SCM_HG
|
||||||
elif [[ -d .svn ]] && [[ -x "$SVN_EXE" ]]; then
|
elif [[ -d .svn ]] && [[ -x "$SVN_EXE" ]]; then
|
||||||
SCM=$SCM_SVN
|
SCM=$SCM_SVN
|
||||||
elif [[ -x "$SVN_EXE" ]] && [[ -n "$(svn info --show-item wc-root 2> /dev/null)" ]]; then
|
elif [[ -x "$SVN_EXE" ]] && [[ -n "$(svn info --show-item wc-root 2>/dev/null)" ]]; then
|
||||||
SCM=$SCM_SVN
|
SCM=$SCM_SVN
|
||||||
else
|
else
|
||||||
SCM=$SCM_NONE
|
SCM=$SCM_NONE
|
||||||
|
|
@ -190,7 +190,7 @@ function terraform_workspace_prompt() {
|
||||||
|
|
||||||
function active_gcloud_account_prompt {
|
function active_gcloud_account_prompt {
|
||||||
if _command_exists gcloud; then
|
if _command_exists gcloud; then
|
||||||
echo -e "$(gcloud config list account --format "value(core.account)" 2> /dev/null)"
|
echo -e "$(gcloud config list account --format "value(core.account)" 2>/dev/null)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,14 +221,14 @@ function git_prompt_vars {
|
||||||
SCM_GIT_GITSTATUS_RAN=false
|
SCM_GIT_GITSTATUS_RAN=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if _git-branch &> /dev/null; then
|
if _git-branch &>/dev/null; then
|
||||||
SCM_GIT_DETACHED="false"
|
SCM_GIT_DETACHED="false"
|
||||||
SCM_BRANCH="${SCM_THEME_BRANCH_PREFIX}\$(_git-friendly-ref)$(_git-remote-info)"
|
SCM_BRANCH="${SCM_THEME_BRANCH_PREFIX}\$(_git-friendly-ref)$(_git-remote-info)"
|
||||||
else
|
else
|
||||||
SCM_GIT_DETACHED="true"
|
SCM_GIT_DETACHED="true"
|
||||||
|
|
||||||
local detached_prefix
|
local detached_prefix
|
||||||
if _git-tag &> /dev/null; then
|
if _git-tag &>/dev/null; then
|
||||||
detached_prefix=${SCM_THEME_TAG_PREFIX}
|
detached_prefix=${SCM_THEME_TAG_PREFIX}
|
||||||
else
|
else
|
||||||
detached_prefix=${SCM_THEME_DETACHED_PREFIX}
|
detached_prefix=${SCM_THEME_DETACHED_PREFIX}
|
||||||
|
|
@ -240,7 +240,7 @@ function git_prompt_vars {
|
||||||
commits_behind=${VCS_STATUS_COMMITS_BEHIND}
|
commits_behind=${VCS_STATUS_COMMITS_BEHIND}
|
||||||
commits_ahead=${VCS_STATUS_COMMITS_AHEAD}
|
commits_ahead=${VCS_STATUS_COMMITS_AHEAD}
|
||||||
else
|
else
|
||||||
IFS=$'\t' read -r commits_behind commits_ahead <<< "$(_git-upstream-behind-ahead)"
|
IFS=$'\t' read -r commits_behind commits_ahead <<<"$(_git-upstream-behind-ahead)"
|
||||||
fi
|
fi
|
||||||
if [[ "${commits_ahead}" -gt 0 ]]; then
|
if [[ "${commits_ahead}" -gt 0 ]]; then
|
||||||
SCM_BRANCH+="${SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR}${SCM_GIT_AHEAD_CHAR}"
|
SCM_BRANCH+="${SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR}${SCM_GIT_AHEAD_CHAR}"
|
||||||
|
|
@ -256,7 +256,7 @@ function git_prompt_vars {
|
||||||
if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then
|
if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then
|
||||||
stash_count=${VCS_STATUS_STASHES}
|
stash_count=${VCS_STATUS_STASHES}
|
||||||
else
|
else
|
||||||
stash_count="$(git stash list 2> /dev/null | wc -l | tr -d ' ')"
|
stash_count="$(git stash list 2>/dev/null | wc -l | tr -d ' ')"
|
||||||
fi
|
fi
|
||||||
[[ "${stash_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_STASH_CHAR_PREFIX}${stash_count}${SCM_GIT_STASH_CHAR_SUFFIX}"
|
[[ "${stash_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_STASH_CHAR_PREFIX}${stash_count}${SCM_GIT_STASH_CHAR_SUFFIX}"
|
||||||
fi
|
fi
|
||||||
|
|
@ -268,7 +268,7 @@ function git_prompt_vars {
|
||||||
unstaged_count=${VCS_STATUS_NUM_UNSTAGED}
|
unstaged_count=${VCS_STATUS_NUM_UNSTAGED}
|
||||||
staged_count=${VCS_STATUS_NUM_STAGED}
|
staged_count=${VCS_STATUS_NUM_STAGED}
|
||||||
else
|
else
|
||||||
IFS=$'\t' read -r untracked_count unstaged_count staged_count <<< "$(_git-status-counts)"
|
IFS=$'\t' read -r untracked_count unstaged_count staged_count <<<"$(_git-status-counts)"
|
||||||
fi
|
fi
|
||||||
if [[ "${untracked_count}" -gt 0 || "${unstaged_count}" -gt 0 || "${staged_count}" -gt 0 ]]; then
|
if [[ "${untracked_count}" -gt 0 || "${unstaged_count}" -gt 0 || "${staged_count}" -gt 0 ]]; then
|
||||||
SCM_DIRTY=1
|
SCM_DIRTY=1
|
||||||
|
|
@ -287,7 +287,7 @@ function git_prompt_vars {
|
||||||
SCM_PREFIX=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX}
|
SCM_PREFIX=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX}
|
||||||
SCM_SUFFIX=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX}
|
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() {
|
function p4_prompt_vars() {
|
||||||
|
|
@ -575,7 +575,8 @@ function __check_precmd_conflict() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function safe_append_prompt_command() {
|
function safe_append_prompt_command() {
|
||||||
local prompt_reif [ "${__bp_imported}" == "defined" ]; then
|
local prompt_re
|
||||||
|
if [ "${__bp_imported}" == "defined" ]; then
|
||||||
# We are using bash-preexec
|
# We are using bash-preexec
|
||||||
if ! __check_precmd_conflict "${1}"; then
|
if ! __check_precmd_conflict "${1}"; then
|
||||||
precmd_functions+=("${1}")
|
precmd_functions+=("${1}")
|
||||||
|
|
@ -598,7 +599,7 @@ function safe_append_prompt_command() {
|
||||||
PROMPT_COMMAND="${1};${PROMPT_COMMAND}"
|
PROMPT_COMMAND="${1};${PROMPT_COMMAND}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function safe_append_prompt_command_kig() {
|
function safe_append_prompt_command_kig() {
|
||||||
local prompt_re
|
local prompt_re
|
||||||
|
|
@ -644,8 +645,9 @@ function prompt_colorscheme() {
|
||||||
"$BASH_IT/colorschemes/${BASH_IT_COLORSCHEME}.colorscheme.bash"
|
"$BASH_IT/colorschemes/${BASH_IT_COLORSCHEME}.colorscheme.bash"
|
||||||
)
|
)
|
||||||
|
|
||||||
for scheme_file in ${colorscheme_locations[@]}; do
|
for scheme_file in "${colorscheme_locations[@]}"; do
|
||||||
if [[ -f ${scheme_file} ]]; then
|
if [[ -f ${scheme_file} ]]; then
|
||||||
|
|
||||||
source "${scheme_file}"
|
source "${scheme_file}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue