Add AIO function to echo scm prompt char and info
Invoking the scm_char and scm_prompt_info functions separately for PS1
duplicates calls to the scm and scm_prompt_char functions to check what
${SCM}, if any, we currently reside in. This problem was exacerbated
when working outside of any repo as we had to go through all the
conditionals just to determine we're not in any scm repo. Unnecessary
conditionals slows down the prompt so this adds a new function that
streamlines printing out both the scm char and scm prompt info with one
invocation.
pull/886/head
parent
3a9c65d541
commit
f9b1dcee26
|
|
@ -111,6 +111,30 @@ function scm_prompt_info {
|
|||
[[ ${SCM} == ${SCM_SVN} ]] && svn_prompt_info && return
|
||||
}
|
||||
|
||||
function scm_prompt_char_info {
|
||||
# Determine the scm char and print it
|
||||
scm_prompt_char
|
||||
echo -ne "${SCM_CHAR}"
|
||||
|
||||
SCM_DIRTY=0
|
||||
SCM_STATE=''
|
||||
|
||||
if [[ ${SCM} == ${SCM_GIT} ]]; then
|
||||
if [[ ${SCM_GIT_SHOW_MINIMAL_INFO} == true ]]; then
|
||||
# user requests minimal git status information
|
||||
git_prompt_minimal_info
|
||||
else
|
||||
# more detailed git status
|
||||
git_prompt_info
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# TODO: consider adding minimal status information for hg and svn
|
||||
[[ ${SCM} == ${SCM_HG} ]] && hg_prompt_info && return
|
||||
[[ ${SCM} == ${SCM_SVN} ]] && svn_prompt_info && return
|
||||
}
|
||||
|
||||
function git_prompt_minimal_info {
|
||||
local ref
|
||||
local status
|
||||
|
|
|
|||
Loading…
Reference in New Issue