Re-structure \[$(tput setaf 4)\][\A]\[$(tput setaf 6)\][\[$(tput setaf 14)\]\u\[$(tput setaf 6)\]@\h \[$(tput setaf 13)\]bashrc\[$(tput sgr0)\] \[$(tput setaf 6)\]\W]\[$(tput sgr0)\]$ for better extensibility, add venv mixin

This commit is contained in:
David Thurstenson 2017-05-25 17:23:45 -05:00
parent 0fd1ad79e7
commit 827d7e1c3b
1 changed files with 11 additions and 6 deletions

17
.bashrc
View File

@ -59,21 +59,26 @@ promptsetup() {
local fg_magenta='\[$(tput setaf 13)\]'
local fg_cyan='\[$(tput setaf 6)\]'
local fg_brightcyan='\[$(tput setaf 14)\]'
local fg_green='\[$(tput setaf 2)\]'
local reset='\[$(tput sgr0)\]'
local hostname='\h'
local mixin
# [hh:mm][username@hostname pwd]$
if [ -n "$SSH_CLIENT" ]; then
# Remotely, hostname is red.
PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@${fg_brightred}\h ${fg_cyan}\W]${reset}\$ "
hostname="${fg_brightred}\h${reset}"
elif [ -n "$VIRTUAL_ENV" ]; then
# If in a vcsh repo env, add repo name in magenta.
mixin=" ${fg_green}$(basename $VIRTUAL_ENV)${reset}"
elif [ -n "$VCSH_REPO_NAME" ]; then
# If in a vcsh repo env, add repo name in magenta.
PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@\h ${fg_magenta}$VCSH_REPO_NAME ${fg_cyan}\W]${reset}\$ "
else
# Locally, hostname is cyan.
PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@\h \W]${reset}\$ "
mixin=" ${fg_magenta}$VCSH_REPO_NAME${reset}"
fi
PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@${hostname}${mixin} ${fg_cyan}\W]${reset}\$ "
}
promptsetup