Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # load less configuration for colored man pages if it exists
- [ -r ~/.lessrc ] && source ~/.lessrc
- __make_last_cmd_status ()
- {
- [ $1 -ne 0 ] && printf "%s%s%s%s " \
- $(tput bold) \
- $(tput setaf 1) \
- $1 \
- $(tput sgr0)
- }
- __make_prompt_user_char ()
- {
- printf "%s%s%s%s" \
- $(tput bold) \
- $(tput setaf $([ $EUID -eq 0 ] && printf 1 || printf 4)) \
- "\\\$" \
- $(tput sgr0)
- }
- __choose_prompt_command ()
- {
- if [ -z "$(type -t __git_ps1)" ]; then
- PS1=$(printf "%s%s %s " \
- "$(__make_last_cmd_status $1)" \
- "\\w" \
- "$(__make_prompt_user_char)")
- else
- GIT_PS1_SHOWDIRTYSTATE=1
- GIT_PS1_SHOWSTASHSTATE=1
- GIT_PS1_SHOWUNTRACKEDFILES=1
- GIT_PS1_SHOWCOLORHINTS=1
- __git_ps1 "$(printf "%s%s" \
- "$(__make_last_cmd_status $1)" \
- "\w ")" \
- "$(__make_prompt_user_char) " \
- "(%s) "
- fi
- }
- PROMPT_COMMAND='__choose_prompt_command $?'
Add Comment
Please, Sign In to add comment