2023-05-09 20:02:34 +00:00
|
|
|
PS2="\
|
2023-08-20 17:41:54 +00:00
|
|
|
├ "
|
2023-08-20 16:33:26 +00:00
|
|
|
|
|
|
|
function ps1 {
|
|
|
|
local code=${1}
|
|
|
|
local date="$(date +%H:%M:%S)"
|
|
|
|
local git
|
|
|
|
local host="$(hostname)"
|
|
|
|
local path="${PWD}"
|
|
|
|
local user="${USER}"
|
2023-08-21 09:43:50 +00:00
|
|
|
local view="└ "
|
|
|
|
if [ ${code} -ne 0 ] ; then
|
|
|
|
view="${view}\e[0;31m"
|
|
|
|
else
|
|
|
|
view="${view}\e[0;32m"
|
|
|
|
fi
|
|
|
|
view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m"
|
2024-11-12 08:49:47 +00:00
|
|
|
if [ "$(type -t __git_ps1)" == "function" ] ; then
|
2023-08-20 16:33:26 +00:00
|
|
|
git="$(__git_ps1)"
|
|
|
|
if [ "${git}" ] ; then
|
|
|
|
view="${view} –\e[0;35m${git}\e[0m"
|
|
|
|
fi
|
|
|
|
fi
|
2023-08-21 09:46:21 +00:00
|
|
|
view="${view}\n\e[0;36m${path}\e[0m"
|
2023-08-21 09:43:50 +00:00
|
|
|
view="${view}\n┌ "
|
|
|
|
if [ ${EUID} -eq 0 ] ; then
|
|
|
|
view="${view}\e[0;31m"
|
|
|
|
else
|
|
|
|
view="${view}\e[0;32m"
|
|
|
|
fi
|
|
|
|
view="${view}${user}\e[0m @ \e[0;33m${host}\e[0m"
|
|
|
|
echo -e "${view}\n${PS2}"
|
2023-08-20 16:33:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PS1='$(eval ps1 ${?})'
|