From 2ae0350f5d5cf1fd66f962e4ce73809d6689045b Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 16 May 2021 16:53:03 +0300 Subject: [PATCH] themes: base: Add unified scm_prompt function --- themes/base.theme.bash | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index a1520397..5663c4a0 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -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