theme/easy: SC2154

Handle all unbound parameters, even colors!
pull/1980/head
John D Pell 2021-09-18 22:57:36 -07:00
parent c7c447a54b
commit fcbe4e90b7
1 changed files with 13 additions and 12 deletions

View File

@ -1,21 +1,22 @@
# shellcheck shell=bash # shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes. # shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_PREFIX="${bold_green}[ ${normal}" SCM_THEME_PROMPT_PREFIX="${bold_green?}[ ${normal?}"
SCM_THEME_PROMPT_SUFFIX="${bold_green} ] " SCM_THEME_PROMPT_SUFFIX="${bold_green?} ] "
SCM_THEME_PROMPT_DIRTY=" ${red}" SCM_THEME_PROMPT_DIRTY=" ${red?}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}" SCM_THEME_PROMPT_CLEAN=" ${bold_green?}"
prompt_command() { function prompt_command() {
if [ "$(whoami)" = root ]; then local scm_prompt_info
cursor_color="${bold_red}" if [ "${USER:-${LOGNAME?}}" = root ]; then
user_color="${green}" cursor_color="${bold_red?}"
user_color="${green?}"
else else
cursor_color="${bold_green}" cursor_color="${bold_green?}"
user_color="${white}" user_color="${white?}"
fi fi
PS1="${user_color}\u${normal}@${white}\h ${bold_black}\w\n${reset_color}$(scm_prompt_info)${cursor_color} ${normal}" scm_prompt_info="$(scm_prompt_info)"
PS1="${user_color}\u${normal?}@${white?}\h ${bold_black?}\w\n${reset_color?}${scm_prompt_info}${cursor_color} ${normal?}"
} }
safe_append_prompt_command prompt_command safe_append_prompt_command prompt_command