2019-05-16 04:17:05 +00:00
|
|
|
# shellcheck disable=SC2016
|
|
|
|
|
2019-05-16 03:45:06 +00:00
|
|
|
promptsetup() {
|
|
|
|
# Color definitions for prompt
|
|
|
|
local fg_brightred='\[$(tput setaf 9)\]'
|
|
|
|
local fg_blue='\[$(tput setaf 4)\]'
|
|
|
|
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]$
|
|
|
|
|
|
|
|
# Remotely, hostname is red.
|
|
|
|
[ -n "$SSH_CLIENT" ] && hostname="${fg_brightred}\h${reset}"
|
|
|
|
|
|
|
|
# If in a python venv, add venv name in green.
|
2019-05-16 04:17:05 +00:00
|
|
|
[ -n "$VIRTUAL_ENV" ] && mixin=" ${fg_green}$(basename "$VIRTUAL_ENV")${reset}"
|
2019-05-16 03:45:06 +00:00
|
|
|
|
|
|
|
# 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}\$ "
|
|
|
|
}
|
|
|
|
|
|
|
|
promptsetup
|