From c7c447a54b75e4bf90c7d33f0898b63ac6a03edb Mon Sep 17 00:00:00 2001 From: John D Pell Date: Sat, 18 Sep 2021 22:52:54 -0700 Subject: [PATCH] theme/candy: SC2154 Handle all unbound parameters, even colors! --- themes/candy/candy.theme.bash | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/themes/candy/candy.theme.bash b/themes/candy/candy.theme.bash index 7753e934..69633bd9 100644 --- a/themes/candy/candy.theme.bash +++ b/themes/candy/candy.theme.bash @@ -1,12 +1,14 @@ # shellcheck shell=bash # shellcheck disable=SC2034 # Expected behavior for themes. -# shellcheck disable=SC2154 #TODO: fix these all. function prompt_command() { - PS1="${green}\u@\h $(clock_prompt) ${reset_color}${white}\w${reset_color}$(scm_prompt_info)${blue} →${bold_blue} ${reset_color} ${normal}" + local clock_prompt scm_prompt_info + clock_prompt="$(clock_prompt)" + scm_prompt_info="$(scm_prompt_info)" + PS1="${green?}\u@\h ${clock_prompt} ${reset_color?}${white?}\w${reset_color?}${scm_prompt_info}${blue?} →${bold_blue?} ${reset_color?} ${normal?}" } -THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue"} -THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%I:%M:%S"} +: "${THEME_CLOCK_COLOR:=${blue?}}" +: "${THEME_CLOCK_FORMAT:="%I:%M:%S"}" safe_append_prompt_command prompt_command