make custom prompts more compatible with p9k

pull/198/head
romkatv 5 years ago
parent 08026f5071
commit cb1f6c4815

@ -1141,9 +1141,10 @@ prompt_host() {
_p9k_custom_prompt() { _p9k_custom_prompt() {
local segment_name=${1:u} local segment_name=${1:u}
local command=POWERLEVEL9K_CUSTOM_${segment_name} local command=POWERLEVEL9K_CUSTOM_${segment_name}
local -a cmd=("${(@Q)${(z)${(P)command}}}") command=${(P)command}
whence $cmd[1] &>/dev/null || return local cmd="${(Q)${(z)command}[1]}"
local content="$("$cmd[@]")" (( $+functions[$cmd] || $+commands[$cmd] )) || return
local content="$(eval $command)"
[[ -n $content ]] || return [[ -n $content ]] || return
_p9k_prompt_segment "prompt_custom_$segment_name" $_p9k_color2 $_p9k_color1 "CUSTOM_${segment_name}_ICON" 0 '' "$content" _p9k_prompt_segment "prompt_custom_$segment_name" $_p9k_color2 $_p9k_color1 "CUSTOM_${segment_name}_ICON" 0 '' "$content"
} }

Loading…
Cancel
Save