31 lines
791 B
Bash
31 lines
791 B
Bash
|
source .git-completion.bash
|
||
|
source .git-prompt.sh
|
||
|
export PYENV_VIRTUALENV_DISABLE_PROMPT=1 # Remove, simulating future behaviour
|
||
|
|
||
|
function updatePrompt {
|
||
|
|
||
|
# Styles
|
||
|
GREEN='\[\e[0;32m\]'
|
||
|
BLUE='\[\e[0;34m\]'
|
||
|
RESET='\[\e[0m\]'
|
||
|
|
||
|
# Base prompt: \W = working dir
|
||
|
PROMPT="${GREEN}\h${RESET} ${BLUE}\W${RESET}"
|
||
|
|
||
|
# Current Git repo
|
||
|
if type "__git_ps1" > /dev/null 2>&1; then
|
||
|
PROMPT="$PROMPT$(__git_ps1 "${BLUE}(%s)${RESET}")"
|
||
|
fi
|
||
|
|
||
|
# Current pyenv version if not system
|
||
|
if [[ $(pyenv version-name) != "system" ]]; then
|
||
|
PROMPT="$PROMPT${BLUE}{$(pyenv version-name)}${RESET}"
|
||
|
fi
|
||
|
|
||
|
PS1="$PROMPT\$ "
|
||
|
}
|
||
|
export -f updatePrompt
|
||
|
|
||
|
# Bash shell executes this function just before displaying the PS1 variable
|
||
|
export PROMPT_COMMAND='updatePrompt'
|