Skip to content

Commit c7c447a

Browse files
committed
theme/candy: SC2154
Handle all unbound parameters, even colors!
1 parent 262e55e commit c7c447a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

themes/candy/candy.theme.bash

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# shellcheck shell=bash
22
# shellcheck disable=SC2034 # Expected behavior for themes.
3-
# shellcheck disable=SC2154 #TODO: fix these all.
43

54
function prompt_command() {
6-
PS1="${green}\u@\h $(clock_prompt) ${reset_color}${white}\w${reset_color}$(scm_prompt_info)${blue}${bold_blue} ${reset_color} ${normal}"
5+
local clock_prompt scm_prompt_info
6+
clock_prompt="$(clock_prompt)"
7+
scm_prompt_info="$(scm_prompt_info)"
8+
PS1="${green?}\u@\h ${clock_prompt} ${reset_color?}${white?}\w${reset_color?}${scm_prompt_info}${blue?}${bold_blue?} ${reset_color?} ${normal?}"
79
}
810

9-
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue"}
10-
THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%I:%M:%S"}
11+
: "${THEME_CLOCK_COLOR:=${blue?}}"
12+
: "${THEME_CLOCK_FORMAT:="%I:%M:%S"}"
1113

1214
safe_append_prompt_command prompt_command

0 commit comments

Comments
 (0)