From 895102edeb6963dbf6242cee7d718f3fc24cf296 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Sat, 18 Sep 2021 22:55:19 -0700 Subject: [PATCH] theme/codeword: SC2154 Handle all unbound parameters, even colors! --- themes/codeword/codeword.theme.bash | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/themes/codeword/codeword.theme.bash b/themes/codeword/codeword.theme.bash index beab6a4a..d52403c1 100644 --- a/themes/codeword/codeword.theme.bash +++ b/themes/codeword/codeword.theme.bash @@ -1,23 +1,23 @@ # shellcheck shell=bash -SCM_THEME_PROMPT_PREFIX=${SCM_THEME_PROMPT_SUFFIX} -SCM_THEME_PROMPT_DIRTY="${bold_red} ✗${normal}" -SCM_THEME_PROMPT_CLEAN="${bold_green} ✓${normal}" -SCM_GIT_CHAR="${green}±${normal}" +SCM_THEME_PROMPT_PREFIX="${SCM_THEME_PROMPT_SUFFIX:-}" +SCM_THEME_PROMPT_DIRTY="${bold_red?} ✗${normal?}" +SCM_THEME_PROMPT_CLEAN="${bold_green?} ✓${normal?}" +SCM_GIT_CHAR="${green?}±${normal?}" -mark_prompt() { - echo "${green}\$${normal}" +function mark_prompt() { + echo "${green?}\$${normal?}" } -user_host_path_prompt() { - ps_user="${green}\u${normal}"; - ps_host="${blue}\H${normal}"; - ps_path="${yellow}\w${normal}"; - echo "$ps_user@$ps_host:$ps_path" +function user_host_path_prompt() { + ps_user="${green?}\u${normal?}"; + ps_host="${blue?}\H${normal?}"; + ps_path="${yellow?}\w${normal?}"; + echo "${ps_user?}@${ps_host?}:${ps_path?}" } -prompt() { - SCM_PROMPT_FORMAT=' [%s%s]' +function prompt() { + local SCM_PROMPT_FORMAT=' [%s%s]' PS1="$(user_host_path_prompt)$(virtualenv_prompt)$(scm_prompt) $(mark_prompt) " }