In themes/sexy add option to visualize python environment

pull/1424/head
Mattia Rigotti 2019-10-04 12:50:06 -04:00
parent 8b7333cd29
commit b0a22e0b97
1 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,10 @@
# Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt"
# Screenshot: http://cloud.gf3.ca/M5rG
# A big thanks to \amethyst on Freenode
#
# Configuration:
# * To visualize python environment (virtualenv and conda) add in your .bash_profile the following line:
# export SEXY_WITH_PYTHON=true
if tput setaf 1 &> /dev/null; then
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
@ -34,9 +38,16 @@ parse_git_dirty () {
parse_git_branch () {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
env_prompt () {
echo -e "($(virtualenv_prompt)$(condaenv_prompt))"
}
function prompt_command() {
PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]at \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]"
if [ "$SEXY_WITH_PYTHON" = true ] ; then
PS1="\[${BOLD}${WHITE}\]$(env_prompt) "$PS1
fi
}
safe_append_prompt_command prompt_command