feat: update rc.d/prompt

This commit is contained in:
Xavier Logerais 2021-05-02 21:32:03 +02:00
parent 554f8a4db8
commit ba9ad2784c

View File

@ -2,19 +2,31 @@
# Customize the prompt # Customize the prompt
if (which powerline-go &> /dev/null); then if (which powerline &> /dev/null); then
function _update_ps1() { function _update_ps1() {
PS1="$(powerline-go -error $?)" PS1="$(powerline -error $? -jobs $(jobs -p | wc -l))"
# Uncomment the following line to automatically clear errors after showing
# them once. This not only clears the error for powerline-go, but also for
# everything else you run in that shell. Don't enable this if you're not
# sure this is what you want.
#set "?"
} }
if [ "$TERM" != "linux" ] ; then
export PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" if [ "$TERM" != "linux" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi fi
else else
if [ "$UID" -eq 0 ]; then if [ "$UID" -eq 0 ]; then
export PS1='\[\e[01;31m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] ' export PS1='\[\e[01;31m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] '
else else
export PS1='\[\e[01;32m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] ' export PS1='\[\e[01;32m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] '
fi fi
fi fi
# Limit the path to 3 levels # Limit the path to 3 levels