From 5986d9e623ec760aa728ced9236bfd9203d8a6ab Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Fri, 19 Nov 2021 10:41:43 +0100 Subject: [PATCH] added pass to status block --- .functions/ps1.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.functions/ps1.sh b/.functions/ps1.sh index b4748ae..a243e7e 100644 --- a/.functions/ps1.sh +++ b/.functions/ps1.sh @@ -20,6 +20,7 @@ function bash_ps1 () { local K8S_CURRENT_CONTEXT="" local DOTF="" local TODO="" + local PASS="" local STATUS="" 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_TODO="${PS1_COLOR_TODO:-\[\033[1;30m\]\[\033[43m\]}" 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="" @@ -65,12 +67,21 @@ function bash_ps1 () { 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 TODO="${PS1_COLOR_TODO}T" fi 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 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}"