prompt
This commit is contained in:
parent
663d99bb14
commit
88162d22fe
1 changed files with 28 additions and 28 deletions
|
@ -1,32 +1,32 @@
|
||||||
ps1() {
|
ps1() {
|
||||||
local code=${1}
|
local code=${1}
|
||||||
local date="$(date +%H:%M:%S)"
|
local date="$(date +%H:%M:%S)"
|
||||||
local git
|
local git
|
||||||
local host="$(hostname)"
|
local host="$(hostname)"
|
||||||
local path="${PWD}"
|
local path="${PWD}"
|
||||||
local user="${USER}"
|
local user="${USER}"
|
||||||
local view="└ "
|
local view="└ "
|
||||||
if [ ${code} -ne 0 ] ; then
|
if [ ${code} -ne 0 ] ; then
|
||||||
view="${view}\e[0;31m"
|
view="${view}\e[0;31m"
|
||||||
else
|
else
|
||||||
view="${view}\e[0;32m"
|
view="${view}\e[0;32m"
|
||||||
fi
|
fi
|
||||||
view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m"
|
view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m"
|
||||||
if [ "$(type -t __git_ps1)" == "function" ] ; then
|
if [ "$(type -t __git_ps1)" == "function" ] ; then
|
||||||
git="$(__git_ps1)"
|
git="$(__git_ps1)"
|
||||||
if [ "${git}" ] ; then
|
if [ "${git}" ] ; then
|
||||||
view="${view} –\e[0;35m${git}\e[0m"
|
view="${view} –\e[0;35m${git}\e[0m"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
view="${view}\n\e[0;36m${path}\e[0m"
|
view="${view}\n\e[0;36m${path}\e[0m"
|
||||||
view="${view}\n┌ "
|
view="${view}\n┌ "
|
||||||
if [ ${EUID} -eq 0 ] ; then
|
if [ ${EUID} -eq 0 ] ; then
|
||||||
view="${view}\e[0;31m"
|
view="${view}\e[0;31m"
|
||||||
else
|
else
|
||||||
view="${view}\e[0;32m"
|
view="${view}\e[0;32m"
|
||||||
fi
|
fi
|
||||||
view="${view}${user}\e[0m @ \e[0;33m${host}\e[0m"
|
view="${view}${user}\e[0m @ \e[0;33m${host}\e[0m"
|
||||||
echo -e "${view}\n${PS2}"
|
echo -e "${view}\n${PS2}"
|
||||||
}
|
}
|
||||||
|
|
||||||
PS1="\$(ps1 \${?})"
|
PS1="\$(ps1 \${?})"
|
||||||
|
|
Loading…
Reference in a new issue