bash/ps1
This commit is contained in:
parent
633f42b6c2
commit
0b7e362582
1 changed files with 33 additions and 13 deletions
|
@ -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 ${?})'
|
||||
|
|
Loading…
Reference in a new issue