Re-structure PS1 for better extensibility, add venv mixin
This commit is contained in:
parent
827d7e1c3b
commit
a030520c1f
17
.bashrc
17
.bashrc
|
@ -65,18 +65,15 @@ promptsetup() {
|
||||||
local mixin
|
local mixin
|
||||||
|
|
||||||
# [hh:mm][username@hostname pwd]$
|
# [hh:mm][username@hostname pwd]$
|
||||||
if [ -n "$SSH_CLIENT" ]; then
|
|
||||||
# Remotely, hostname is red.
|
|
||||||
hostname="${fg_brightred}\h${reset}"
|
|
||||||
|
|
||||||
elif [ -n "$VIRTUAL_ENV" ]; then
|
# Remotely, hostname is red.
|
||||||
# If in a vcsh repo env, add repo name in magenta.
|
[ -n "$SSH_CLIENT" ] && hostname="${fg_brightred}\h${reset}"
|
||||||
mixin=" ${fg_green}$(basename $VIRTUAL_ENV)${reset}"
|
|
||||||
|
|
||||||
elif [ -n "$VCSH_REPO_NAME" ]; then
|
# If in a python venv, add venv name in green.
|
||||||
# If in a vcsh repo env, add repo name in magenta.
|
[ -n "$VIRTUAL_ENV" ] && mixin=" ${fg_green}$(basename $VIRTUAL_ENV)${reset}"
|
||||||
mixin=" ${fg_magenta}$VCSH_REPO_NAME${reset}"
|
|
||||||
fi
|
# If in a vcsh repo env, add repo name in magenta.
|
||||||
|
[ -n "$VCSH_REPO_NAME" ] && mixin=" ${fg_magenta}$VCSH_REPO_NAME${reset}"
|
||||||
|
|
||||||
PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@${hostname}${mixin} ${fg_cyan}\W]${reset}\$ "
|
PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@${hostname}${mixin} ${fg_cyan}\W]${reset}\$ "
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue