From 4b82d2b12e7ed140201fc7d556bc99a25797de7a Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Fri, 26 Nov 2021 10:16:18 +0100 Subject: [PATCH] streamlined STATUS --- .functions/ps1.sh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.functions/ps1.sh b/.functions/ps1.sh index 938a1a3..5e4b053 100644 --- a/.functions/ps1.sh +++ b/.functions/ps1.sh @@ -18,9 +18,6 @@ function bash_ps1 () { local GIT_BRANCH="" local PYTHON_ENV="" local K8S_CURRENT_CONTEXT="" - local DOTF="" - local TODO="" - local PASS="" local STATUS="" local PS1_COLOR_OFF='\[\033[0m\]' @@ -59,29 +56,29 @@ function bash_ps1 () { if [[ $(type -t status_dotfiles) == function ]];then if [[ $(status_dotfiles check_error) == YES ]];then - DOTF="${PS1_COLOR_DOTF}E" + STATUS="${PS1_COLOR_DOTF}E" elif [[ $(status_dotfiles check_status) ]];then - DOTF="${PS1_COLOR_DOTF}+" + STATUS="${PS1_COLOR_DOTF}+" elif [[ $(status_dotfiles check_push) ]];then - DOTF="${PS1_COLOR_DOTF}p" + STATUS="${PS1_COLOR_DOTF}p" fi fi if type -t pass > /dev/null; then if [[ -n "$(pass git status --short 2> /dev/null)" ]];then - PASS="${PS1_COLOR_PASS}%" + STATUS="${STATUS}${PS1_COLOR_PASS}%" elif [[ -n "$(pass git cherry -v)" ]];then - PASS="${PS1_COLOR_PASS}p" + STATUS="${STATUS}${PS1_COLOR_PASS}p" fi fi if [[ $(type -t todo_status) == function ]] && [[ "$(todo_status)" == "YES" ]];then - TODO="${PS1_COLOR_TODO}T" + STATUS="${STATUS}${PS1_COLOR_TODO}T" fi - if [[ -n $DOTF ]] || [[ -n $TODO ]] || [[ -n $PASS ]];then - STATUS="${PS1_COLOR_DIVIDER}─[${DOTF}${TODO}${PASS}${PS1_COLOR_DIVIDER}]" + if [[ -n $STATUS ]];then + STATUS="${PS1_COLOR_DIVIDER}─[${STATUS}${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}"