add REMOTE_ROOT context

This commit is contained in:
Emil Vanherp 2020-09-05 00:37:40 +02:00
parent 622130980c
commit 97615b63c4
1 changed files with 10 additions and 2 deletions

View File

@ -1502,7 +1502,9 @@ prompt_context() {
local state local state
if (( P9K_SSH )); then if (( P9K_SSH )); then
if [[ -n "$SUDO_COMMAND" ]]; then if [[ "$UID" -eq 0 ]]; then
state="REMOTE_ROOT"
elif [[ -n "$SUDO_COMMAND" ]]; then
state="REMOTE_SUDO" state="REMOTE_SUDO"
else else
state="REMOTE" state="REMOTE"
@ -1514,7 +1516,13 @@ prompt_context() {
fi fi
local cond local cond
for state cond in $state '${${(%):-%#}:#\#}' ROOT '${${(%):-%#}:#\%}'; do local root
if [[ $state = "REMOTE_ROOT" ]]; then
root=$state
else
root="ROOT"
fi
for state cond in $state '${${(%):-%#}:#\#}' $root '${${(%):-%#}:#\%}'; do
local text=$content local text=$content
if [[ -z $text ]]; then if [[ -z $text ]]; then
local var=_POWERLEVEL9K_CONTEXT_${state}_TEMPLATE local var=_POWERLEVEL9K_CONTEXT_${state}_TEMPLATE