themes: Lint pure theme

pull/1881/head
Noah Gorny 2021-05-16 13:59:18 +03:00
parent 7f193a2e05
commit b65a7cc67c
1 changed files with 23 additions and 21 deletions

View File

@ -1,3 +1,5 @@
# shellcheck shell=bash
# scm theming # scm theming
SCM_THEME_PROMPT_PREFIX="|" SCM_THEME_PROMPT_PREFIX="|"
SCM_THEME_PROMPT_SUFFIX="" SCM_THEME_PROMPT_SUFFIX=""
@ -18,27 +20,27 @@ VIRTUALENV_THEME_PROMPT_SUFFIX=")"
scm_prompt() { scm_prompt() {
CHAR=$(scm_char) CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ] if [[ $CHAR = "$SCM_NONE_CHAR" ]]; then
then
return return
else else
echo "[$(scm_char)$(scm_prompt_info)]" echo -e "[$(scm_char)$(scm_prompt_info)]"
fi fi
} }
pure_prompt() { pure_prompt() {
ps_host="${bold_blue}\h${normal}"; ps_host="${bold_blue}\h${normal}"
ps_user="${green}\u${normal}"; ps_user="${green}\u${normal}"
ps_user_mark="${green} $ ${normal}"; ps_user_mark="${green} $ ${normal}"
ps_root="${red}\u${red}"; ps_root="${red}\u${red}"
ps_root_mark="${red} # ${normal}" ps_root_mark="${red} # ${normal}"
ps_path="${yellow}\w${normal}"; ps_path="${yellow}\w${normal}"
# make it work # make it work
case $(id -u) in case $(id -u) in
0) PS1="$(virtualenv_prompt)$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark" 0)
PS1="$(virtualenv_prompt)$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark"
;; ;;
*) PS1="$(virtualenv_prompt)$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark" *)
PS1="$(virtualenv_prompt)$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark"
;; ;;
esac esac
} }