This commit is contained in:
Marc Beninca 2024-11-16 02:27:43 +01:00
parent ba3b90366b
commit ce576b7a99
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -55,26 +55,41 @@ ps1() {
local path="${PWD}"
local user="${USER}"
local view="└ "
# code
if [ "${code}" -ne 0 ]; then
view="${view}${SH_GREEN}"
else
view="${view}${SH_RED}"
fi
view="${view}${code}${SH_DEFAULT} @ ${SH_BROWN}${date}${SH_DEFAULT}"
view="${view}${code}"
# date
view="${view}${SH_DEFAULT} @ "
view="${view}${SH_BROWN}${date}"
# git
if [ "$(type -t __git_ps1)" = "function" ]; then
git="$(__git_ps1)"
if [ -n "${git}" ]; then
view="${view}${SH_MAGENTA}${git}${SH_DEFAULT}"
view="${view}${SH_DEFAULT}${SH_MAGENTA}${git}"
fi
fi
view="${view}\n${SH_CYAN}${path}${SH_DEFAULT}"
view="${view}\n┌ "
# new
view="${view}\n"
# path
view="${view}${SH_CYAN}${path}"
# new
view="${view}\n"
# frame
view="${view}"
# user
if [ "${id}" -eq 0 ]; then
view="${view}${SH_GREEN}"
else
view="${view}${SH_RED}"
fi
view="${view}${user}${SH_DEFAULT} @ ${SH_BROWN}${host}${SH_DEFAULT}"
view="${view}${user}"
# host
view="${view}${SH_DEFAULT} @ "
view="${view}${SH_BROWN}${host}${SH_DEFAULT}"
echo -e "${view}\n${PS2}"
}