|
|
@ -571,24 +571,25 @@ prompt_context() {
|
|
|
|
context_states=(
|
|
|
|
context_states=(
|
|
|
|
"ROOT" "yellow"
|
|
|
|
"ROOT" "yellow"
|
|
|
|
"DEFAULT" "yellow"
|
|
|
|
"DEFAULT" "yellow"
|
|
|
|
|
|
|
|
"REMOTE" "yellow"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
local content=""
|
|
|
|
local content=""
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "$POWERLEVEL9K_ALWAYS_SHOW_CONTEXT" == true ]] || [[ "$(whoami)" != "$DEFAULT_USER" ]] || [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then
|
|
|
|
if [[ "$POWERLEVEL9K_ALWAYS_SHOW_CONTEXT" == true ]] || [[ "$(whoami)" != "$DEFAULT_USER" ]] || [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $(print -P "%#") == '#' ]]; then
|
|
|
|
|
|
|
|
current_state="ROOT"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
content="${POWERLEVEL9K_CONTEXT_TEMPLATE}"
|
|
|
|
content="${POWERLEVEL9K_CONTEXT_TEMPLATE}"
|
|
|
|
|
|
|
|
|
|
|
|
elif [[ "$POWERLEVEL9K_ALWAYS_SHOW_USER" == true ]]; then
|
|
|
|
elif [[ "$POWERLEVEL9K_ALWAYS_SHOW_USER" == true ]]; then
|
|
|
|
content="$(whoami)"
|
|
|
|
content="$(whoami)"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $(print -P "%#") == '#' ]]; then
|
|
|
|
|
|
|
|
current_state="ROOT"
|
|
|
|
|
|
|
|
elif [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then
|
|
|
|
|
|
|
|
current_state="REMOTE"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
"$1_prompt_segment" "${0}_${current_state}" "$2" "$DEFAULT_COLOR" "${context_states[$current_state]}" "${content}"
|
|
|
|
"$1_prompt_segment" "${0}_${current_state}" "$2" "$DEFAULT_COLOR" "${context_states[$current_state]}" "${content}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|