1
0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-12 19:18:28 +02:00

make custom prompts more compatible with p9k

This commit is contained in:
romkatv 2019-08-24 12:58:55 +02:00
parent 08026f5071
commit cb1f6c4815

View File

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