theme/bira: SC2154

Handle all unbound parameters, even colors!
pull/1977/head
John D Pell 2021-09-18 22:18:36 -07:00
parent 2c14a18483
commit 4bc83d7940
1 changed files with 12 additions and 10 deletions

View File

@ -1,24 +1,26 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_PREFIX=" ${yellow}"
SCM_THEME_PROMPT_SUFFIX="${reset_color}"
SCM_THEME_PROMPT_PREFIX=" ${yellow?}"
SCM_THEME_PROMPT_SUFFIX="${reset_color?}"
VIRTUALENV_THEME_PROMPT_PREFIX=" ${cyan}"
VIRTUALENV_THEME_PROMPT_SUFFIX="${reset_color}"
VIRTUALENV_THEME_PROMPT_PREFIX=" ${cyan?}"
VIRTUALENV_THEME_PROMPT_SUFFIX="${reset_color?}"
bold="\[\e[1m\]"
if [ ${UID} -eq 0 ]; then
user_host="${bold_red}\u@\h${normal}${reset_color}"
if [[ ${UID} -eq 0 ]]; then
user_host="${bold_red?}\u@\h${normal?}${reset_color?}"
else
user_host="${bold_green}\u@\h${normal}${reset_color}"
user_host="${bold_green?}\u@\h${normal?}${reset_color?}"
fi
function prompt_command() {
local current_dir=" ${bold_blue}\w${normal}${reset_color}"
PS1="╭─${user_host}${current_dir}$(virtualenv_prompt)$(scm_prompt_info)\n╰─${bold}\\$ ${normal}"
local current_dir=" ${bold_blue?}\w${normal?}${reset_color?}"
local virtualenv_prompt scm_prompt_info
virtualenv_prompt="$(virtualenv_prompt)"
scm_prompt_info="$(scm_prompt_info)"
PS1="╭─${user_host?}${current_dir}${virtualenv_prompt}${scm_prompt_info}\n╰─${bold?}\\$ ${normal?}"
}
safe_append_prompt_command prompt_command