theme/bobby: SC2154

Handle all unbound parameters, even colors!
pull/1980/head
John D Pell 2021-09-18 22:21:11 -07:00
parent 6db5f38f6e
commit 262e55eda2
2 changed files with 34 additions and 36 deletions

View File

@ -1,27 +1,26 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_DIRTY=" ${red}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}"
SCM_THEME_PROMPT_DIRTY=" ${red?}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green?}"
SCM_THEME_PROMPT_PREFIX=" |"
SCM_THEME_PROMPT_SUFFIX="${green}|"
SCM_THEME_PROMPT_SUFFIX="${green?}|"
GIT_THEME_PROMPT_DIRTY=" ${red}"
GIT_THEME_PROMPT_CLEAN=" ${bold_green}"
GIT_THEME_PROMPT_PREFIX=" ${green}|"
GIT_THEME_PROMPT_SUFFIX="${green}|"
GIT_THEME_PROMPT_DIRTY=" ${red?}"
GIT_THEME_PROMPT_CLEAN=" ${bold_green?}"
GIT_THEME_PROMPT_PREFIX=" ${green?}|"
GIT_THEME_PROMPT_SUFFIX="${green?}|"
CONDAENV_THEME_PROMPT_SUFFIX="|"
function prompt_command() {
PS1="\n${yellow}$(python_version_prompt) " # Name of virtual env followed by python version
PS1+="${purple}\h "
PS1+="${reset_color}in "
PS1+="${green}\w\n"
PS1+="${bold_cyan}$(scm_char)"
PS1+="${green}$(scm_prompt_info) "
PS1+="${green}${reset_color} "
PS1="\n${yellow?}$(python_version_prompt) " # Name of virtual env followed by python version
PS1+="${purple?}\h "
PS1+="${reset_color?}in "
PS1+="${green?}\w\n"
PS1+="${bold_cyan?}$(scm_char)"
PS1+="${green?}$(scm_prompt_info) "
PS1+="${green?}${reset_color?} "
}
safe_append_prompt_command prompt_command

View File

@ -1,41 +1,40 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_DIRTY=" ${red}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}"
SCM_THEME_PROMPT_PREFIX=" ${green}|"
SCM_THEME_PROMPT_SUFFIX="${green}|"
SCM_THEME_PROMPT_DIRTY=" ${red?}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green?}"
SCM_THEME_PROMPT_PREFIX=" ${green?}|"
SCM_THEME_PROMPT_SUFFIX="${green?}|"
GIT_THEME_PROMPT_DIRTY=" ${red}"
GIT_THEME_PROMPT_CLEAN=" ${bold_green}"
GIT_THEME_PROMPT_PREFIX=" ${green}|"
GIT_THEME_PROMPT_SUFFIX="${green}|"
GIT_THEME_PROMPT_DIRTY=" ${red?}"
GIT_THEME_PROMPT_CLEAN=" ${bold_green?}"
GIT_THEME_PROMPT_PREFIX=" ${green?}|"
GIT_THEME_PROMPT_SUFFIX="${green?}|"
RVM_THEME_PROMPT_PREFIX="|"
RVM_THEME_PROMPT_SUFFIX="|"
__bobby_clock() {
function __bobby_clock() {
printf '%s' "$(clock_prompt) "
if [ "${THEME_SHOW_CLOCK_CHAR}" == "true" ]; then
if [[ "${THEME_SHOW_CLOCK_CHAR:-}" == "true" ]]; then
printf '%s' "$(clock_char) "
fi
}
function prompt_command() {
PS1="\n$(battery_char) $(__bobby_clock)"
PS1+="${yellow}$(ruby_version_prompt) "
PS1+="${purple}\h "
PS1+="${reset_color}in "
PS1+="${green}\w\n"
PS1+="${bold_cyan}$(scm_prompt_char_info) "
PS1+="${green}${reset_color} "
PS1+="${yellow?}$(ruby_version_prompt) "
PS1+="${purple?}\h "
PS1+="${reset_color?}in "
PS1+="${green?}\w\n"
PS1+="${bold_cyan?}$(scm_prompt_char_info) "
PS1+="${green?}${reset_color?} "
}
THEME_SHOW_CLOCK_CHAR=${THEME_SHOW_CLOCK_CHAR:-"true"}
THEME_CLOCK_CHAR_COLOR=${THEME_CLOCK_CHAR_COLOR:-"$red"}
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$bold_cyan"}
THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%Y-%m-%d %H:%M:%S"}
: "${THEME_SHOW_CLOCK_CHAR:="true"}"
: "${THEME_CLOCK_CHAR_COLOR:=${red?}}"
: "${THEME_CLOCK_COLOR:=${bold_cyan?}}"
: "${THEME_CLOCK_FORMAT:="%Y-%m-%d %H:%M:%S"}"
safe_append_prompt_command prompt_command