added pass to status block

This commit is contained in:
Jonas Forsberg 2021-11-19 10:41:43 +01:00
parent fd51915295
commit 5986d9e623
No known key found for this signature in database
GPG Key ID: F2E9818C70350CC9

View File

@ -20,6 +20,7 @@ function bash_ps1 () {
local K8S_CURRENT_CONTEXT="" local K8S_CURRENT_CONTEXT=""
local DOTF="" local DOTF=""
local TODO="" local TODO=""
local PASS=""
local STATUS="" local STATUS=""
local PS1_COLOR_OFF='\[\033[0m\]' local PS1_COLOR_OFF='\[\033[0m\]'
@ -34,6 +35,7 @@ function bash_ps1 () {
local PS1_COLOR_KUBERNETES="${PS1_COLOR_KUBERNETES:-\[\033[1;37m\]\[\033[44m\]}" local PS1_COLOR_KUBERNETES="${PS1_COLOR_KUBERNETES:-\[\033[1;37m\]\[\033[44m\]}"
local PS1_COLOR_TODO="${PS1_COLOR_TODO:-\[\033[1;30m\]\[\033[43m\]}" local PS1_COLOR_TODO="${PS1_COLOR_TODO:-\[\033[1;30m\]\[\033[43m\]}"
local PS1_COLOR_DOTF="${PS1_COLOR_DOTF:-\[\033[1;37m\]\[\033[45m\]}" local PS1_COLOR_DOTF="${PS1_COLOR_DOTF:-\[\033[1;37m\]\[\033[45m\]}"
local PS1_COLOR_PASS="${PS1_COLOR_PASS:-\[\033[0;30m\]\[\033[47m\]}"
local CURRENT_CONTEXT="" local CURRENT_CONTEXT=""
@ -65,12 +67,21 @@ function bash_ps1 () {
fi fi
fi fi
if type -t pass > /dev/null; then
if [[ -n "$(pass git status --short 2> /dev/null)" ]];then
PASS="${PS1_COLOR_PASS}%"
elif [[ -n "$(pass git cherry -v)" ]];then
PASS="${PS1_COLOR_PASS}p"
fi
fi
if [[ $(type -t todo_status) == function ]] && [[ "$(todo_status)" == "YES" ]];then if [[ $(type -t todo_status) == function ]] && [[ "$(todo_status)" == "YES" ]];then
TODO="${PS1_COLOR_TODO}T" TODO="${PS1_COLOR_TODO}T"
fi fi
if [[ -n $DOTF ]] || [[ -n $TODO ]];then if [[ -n $DOTF ]] || [[ -n $TODO ]];then
STATUS="${PS1_COLOR_DIVIDER}─[${DOTF}${TODO}${PS1_COLOR_DIVIDER}]" STATUS="${PS1_COLOR_DIVIDER}─[${DOTF}${TODO}${PASS}${PS1_COLOR_DIVIDER}]"
fi fi
PS1="\n${PS1_COLOR_DIVIDER}┌──(${PS1_COLOR_USERNAME}\u${PS1_COLOR_USERHOSTAT}@${PS1_COLOR_HOSTNAME}\h${PS1_COLOR_DIVIDER})─[${PS1_COLOR_PATH}\w${PS1_COLOR_DIVIDER}]${EXIT_STATUS}${STATUS}${PYTHON_ENV}${K8S_CURRENT_CONTEXT}${GIT_BRANCH}" PS1="\n${PS1_COLOR_DIVIDER}┌──(${PS1_COLOR_USERNAME}\u${PS1_COLOR_USERHOSTAT}@${PS1_COLOR_HOSTNAME}\h${PS1_COLOR_DIVIDER})─[${PS1_COLOR_PATH}\w${PS1_COLOR_DIVIDER}]${EXIT_STATUS}${STATUS}${PYTHON_ENV}${K8S_CURRENT_CONTEXT}${GIT_BRANCH}"