theme/codeword: SC2154
Handle all unbound parameters, even colors!
This commit is contained in:
@@ -1,23 +1,23 @@
|
|||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
SCM_THEME_PROMPT_PREFIX=${SCM_THEME_PROMPT_SUFFIX}
|
SCM_THEME_PROMPT_PREFIX="${SCM_THEME_PROMPT_SUFFIX:-}"
|
||||||
SCM_THEME_PROMPT_DIRTY="${bold_red} ✗${normal}"
|
SCM_THEME_PROMPT_DIRTY="${bold_red?} ✗${normal?}"
|
||||||
SCM_THEME_PROMPT_CLEAN="${bold_green} ✓${normal}"
|
SCM_THEME_PROMPT_CLEAN="${bold_green?} ✓${normal?}"
|
||||||
SCM_GIT_CHAR="${green}±${normal}"
|
SCM_GIT_CHAR="${green?}±${normal?}"
|
||||||
|
|
||||||
mark_prompt() {
|
function mark_prompt() {
|
||||||
echo "${green}\$${normal}"
|
echo "${green?}\$${normal?}"
|
||||||
}
|
}
|
||||||
|
|
||||||
user_host_path_prompt() {
|
function user_host_path_prompt() {
|
||||||
ps_user="${green}\u${normal}";
|
ps_user="${green?}\u${normal?}";
|
||||||
ps_host="${blue}\H${normal}";
|
ps_host="${blue?}\H${normal?}";
|
||||||
ps_path="${yellow}\w${normal}";
|
ps_path="${yellow?}\w${normal?}";
|
||||||
echo "$ps_user@$ps_host:$ps_path"
|
echo "${ps_user?}@${ps_host?}:${ps_path?}"
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt() {
|
function prompt() {
|
||||||
SCM_PROMPT_FORMAT=' [%s%s]'
|
local SCM_PROMPT_FORMAT=' [%s%s]'
|
||||||
PS1="$(user_host_path_prompt)$(virtualenv_prompt)$(scm_prompt) $(mark_prompt) "
|
PS1="$(user_host_path_prompt)$(virtualenv_prompt)$(scm_prompt) $(mark_prompt) "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user