themes: base: Add unified scm_prompt function

pull/1881/head
Noah Gorny 2021-05-16 16:53:03 +03:00
parent b65a7cc67c
commit 2ae0350f5d
1 changed files with 12 additions and 0 deletions

View File

@ -121,6 +121,18 @@ function scm {
fi
}
scm_prompt() {
local CHAR=$(scm_char)
local format=${SCM_PROMPT_FORMAT:-'[%s%s]'}
if [[ $CHAR = "$SCM_NONE_CHAR" ]]; then
return
else
# shellcheck disable=2059
printf "$format\n" "$CHAR" "$(scm_prompt_info)"
fi
}
function scm_prompt_char {
if [[ -z $SCM ]]; then scm; fi
if [[ $SCM == "$SCM_GIT" ]]; then