feat(PS1): add shell level

This commit is contained in:
matt1432 2023-10-06 01:45:15 -04:00
parent 244c4240ce
commit 8d3e08569a

View file

@ -18,7 +18,12 @@ set_prompt() {
STATUS="$FAILED"
fi
PS1="╭╴$USER_COLOR\u$HOST_COLOR@\h$BRANCH$WHITE:$PURPLE\w$WHITE $STATUS\n╰╴$ "
LEVEL=""
if [ $SHLVL -gt 1 ]; then
LEVEL="shellDepth=\$((SHLVL-1))"
fi
PS1="╭╴$USER_COLOR\u$HOST_COLOR@\h$BRANCH$WHITE:$PURPLE\w$WHITE $LEVEL $STATUS\n╰╴$ "
}
PROMPT_COMMAND="set_prompt \$?; history -a"