streamlined STATUS

This commit is contained in:
Jonas Forsberg 2021-11-26 10:16:18 +01:00
parent 6d91972799
commit 4b82d2b12e
No known key found for this signature in database
GPG Key ID: F2E9818C70350CC9

View File

@ -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}"