Update super prompt to use docker context.

This commit is contained in:
Anna Rose 2019-09-17 17:37:18 -04:00
parent fb175ccd63
commit d6f5dc9c34

View File

@ -30,4 +30,9 @@ function sp_path {
echo $path
}
export PS1="[${C_YELLOW}\u${C_NO}@${C_BLUE}${HOSTNAME}${C_NO}:${C_GREEN}\$(sp_path)${C_NO}] ${C_MAGENTA}\$(sp_git)${C_NO}\n${C_RED}\$ ${C_NO}"
function sp_docker_context {
local name=$(docker context inspect | grep Name | tr -d ' ' | sed -E "s/\"Name\":\"(.*)\",/\1/")
[ $name != 'default' ] && echo $name
}
export PS1="[${C_YELLOW}\u${C_NO}@${C_BLUE}${HOSTNAME}${C_NO}:${C_GREEN}\$(sp_path)${C_NO}] ${C_MAGENTA}\$(sp_git)${C_NO} ${C_GREEN}\$(sp_docker_context)${C_NO} ${C_RED}\$(echo -n \$DOCKER_MACHINE_NAME)${C_NO} \n${C_RED}\$ ${C_NO}"