Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: e47beef0ec
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (35 sloc) 1.33 kB
#!/bin/bash
bash_prompt() {
case $TERM in
@(xterm|rxvt)*)
local TITLEBAR='\[\e]0;\u:${NEW_PWD}\007\]' ;;
esac
local NONE='\[\e[0m\]' # unsets color to term's fg color
# regular colors
local K='\[\e[0;30m\]' R='\[\e[0;31m\]' G='\[\e[0;32m\]' Y='\[\e[0;33m\]' \
B='\[\e[0;34m\]' M='\[\e[0;35m\]' C='\[\e[0;36m\]' W='\[\e[0;37m\]'
# emphasized (bolded) colors
local EMK='\[\e[1;30m\]' EMR='\[\e[1;31m\]' EMG='\[\e[1;32m\]' EMY='\[\e[1;33m\]' \
EMB='\[\e[1;34m\]' EMM='\[\e[1;35m\]' EMC='\[\e[1;36m\]' EMW='\[\e[1;37m\]'
# username/host color for root/other
(( UID != 0 )) && local UC=$W || local UC=$R
RET_VALUE='$((( RET )) && printf ":\[\e[1;31m\]$RET\[\e[0m\]")'
# different color for remote hosts
[[ $SSH_TTY ]] && local HC=$C || local HC=$W
# space goes inside the printf so its not there when there's no git branch
PS1="$TITLEBAR $EMK┌┤$HC\h$EMK->$UC\u$RET_VALUE\$(__git_ps1 ' \[\e[0;32m\]%s\[\e[0m\]') $EMB\w$EMK$UC\n $EMK└➤$NONE "
export PS4='+$BASH_SOURCE[$LINENO]: '
}
# chroot prompt
if [[ -f /.chroot ]]; then
root_name=$(< /.chroot)
root_name=${root_name:-NONAME}
PS1='[\u@\h${root_name} \w]\$ '
return
else
# show return val of last command
PROMPT_COMMAND='RET=$?'
GIT_PS1_SHOWDIRTYSTATE=yes
bash_prompt
unset bash_prompt
fi
Jump to Line
Something went wrong with that request. Please try again.