diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index b68611d..a245867 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -1,15 +1,35 @@ -PS1="\ -└ \t\ - – \e[0;31m\${?}\e[0m\ - – \e[0;32m\u\e[0m\ - @ \e[0;33m\h\e[0m\ -" -if [ "$(type -t __git_ps1)" == 'function' ] ; then - PS1="${PS1} –\e[0;35m\$(__git_ps1)\e[0m" -fi -PS1="${PS1} -┌ \e[0;36m\${PWD}\e[0m -│ " - PS2="\ │ " + +function ps1 { +local code=${1} +local date="$(date +%H:%M:%S)" +local git +local host="$(hostname)" +local path="${PWD}" +local real="$(realpath "${path}")" +local user="${USER}" +local view="\ +└ ${date}\ + – \e[0;31m${code}\e[0m\ + – \e[0;32m${user}\e[0m\ + @ \e[0;33m${host}\e[0m\ +" + if [ "$(type -t __git_ps1)" == 'function' ] ; then + git="$(__git_ps1)" + if [ "${git}" ] ; then + view="${view} –\e[0;35m${git}\e[0m" + fi + fi + view="${view} +┌ " + if [ "${path}" != "${real}" ] ; then + view="${view}\e[0;36m${real}\e[0m +├ " + fi + view="${view}\e[0;36m${path}\e[0m +${PS2}" + echo -e "${view}" +} + +PS1='$(eval ps1 ${?})'