add new icons and add remote_sudo

This commit is contained in:
Michael Louwrens 2018-02-12 11:28:00 +02:00
commit 7fff5bd7a6
2 changed files with 14 additions and 6 deletions

View file

@ -589,10 +589,11 @@ prompt_context() {
local current_state="DEFAULT"
typeset -AH context_states
context_states=(
"ROOT" "yellow"
"SUDO" "yellow"
"DEFAULT" "yellow"
"REMOTE" "yellow"
"ROOT" "yellow"
"SUDO" "yellow"
"DEFAULT" "yellow"
"REMOTE" "yellow"
"REMOTE_SUDO" "yellow"
)
local content=""
@ -608,7 +609,11 @@ prompt_context() {
if [[ $(print -P "%#") == '#' ]]; then
current_state="ROOT"
elif [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then
current_state="REMOTE"
if sudo -n true 2>/dev/null; then
current_state="REMOTE_SUDO"
else
current_state="REMOTE"
fi
elif sudo -n true 2>/dev/null; then
current_state="SUDO"
fi