Skip to content

Commit

Permalink
theme/candy: SC2154
Browse files Browse the repository at this point in the history
Handle all unbound parameters, even colors!
  • Loading branch information
gaelicWizard committed Jan 8, 2022
1 parent 262e55e commit c7c447a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions themes/candy/candy.theme.bash
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c7c447a

Please sign in to comment.