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