This commit is contained in:
Marc Beninca 2024-11-20 14:29:42 +01:00
parent 86db452e72
commit 942de1caed
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -23,12 +23,12 @@ _sh_shell_color() {
;; ;;
esac esac
} }
SH_BROWN="$(_sh_shell_color 33)" SH_COLOR_BROWN="$(_sh_shell_color 33)"
SH_CYAN="$(_sh_shell_color 36)" SH_COLOR_CYAN="$(_sh_shell_color 36)"
SH_DEFAULT="$(_sh_shell_color)" SH_COLOR_DEFAULT="$(_sh_shell_color)"
SH_GREEN="$(_sh_shell_color 31)" SH_COLOR_GREEN="$(_sh_shell_color 31)"
SH_MAGENTA="$(_sh_shell_color 35)" SH_COLOR_MAGENTA="$(_sh_shell_color 35)"
SH_RED="$(_sh_shell_color 32)" SH_COLOR_RED="$(_sh_shell_color 32)"
shell_configure() { shell_configure() {
case "${SH_SHELL}" in case "${SH_SHELL}" in
@ -70,43 +70,43 @@ sh_shell_prompt() {
local view="└ " local view="└ "
# code # code
if [ "${code}" -ne 0 ]; then if [ "${code}" -ne 0 ]; then
view="${view}${SH_GREEN}" view="${view}${SH_COLOR_GREEN}"
else else
view="${view}${SH_RED}" view="${view}${SH_COLOR_RED}"
fi fi
view="${view}${code}" view="${view}${code}"
# date # date
view="${view}${SH_DEFAULT} @ " view="${view}${SH_COLOR_DEFAULT} @ "
view="${view}${SH_BROWN}${date}" view="${view}${SH_COLOR_BROWN}${date}"
# git # git
if command -v "__git_ps1" >"/dev/null"; then if command -v "__git_ps1" >"/dev/null"; then
git="$(__git_ps1)" git="$(__git_ps1)"
if [ -n "${git}" ]; then if [ -n "${git}" ]; then
view="${view}${SH_DEFAULT}${SH_MAGENTA}${git}" view="${view}${SH_COLOR_DEFAULT}${SH_COLOR_MAGENTA}${git}"
fi fi
fi fi
# new # new
view="${view}\\n" view="${view}\\n"
# path # path
view="${view}${SH_CYAN}${path}" view="${view}${SH_COLOR_CYAN}${path}"
# new # new
view="${view}\\n" view="${view}\\n"
# frame # frame
view="${view}${SH_DEFAULT}" view="${view}${SH_COLOR_DEFAULT}"
# user # user
if [ "${id}" -eq 0 ]; then if [ "${id}" -eq 0 ]; then
view="${view}${SH_GREEN}" view="${view}${SH_COLOR_GREEN}"
else else
view="${view}${SH_RED}" view="${view}${SH_COLOR_RED}"
fi fi
view="${view}${user}" view="${view}${user}"
# host # host
view="${view}${SH_DEFAULT} @ " view="${view}${SH_COLOR_DEFAULT} @ "
view="${view}${SH_BROWN}${host}" view="${view}${SH_COLOR_BROWN}${host}"
# new # new
view="${view}\\n" view="${view}\\n"
# prompt # prompt
view="${view}${SH_DEFAULT}${PS2}" view="${view}${SH_COLOR_DEFAULT}${PS2}"
# print # print
printf "%b" "${view}" printf "%b" "${view}"
} }