From cb1f6c48156e503a85a782194218c38ac28fec4b Mon Sep 17 00:00:00 2001 From: romkatv Date: Sat, 24 Aug 2019 12:58:55 +0200 Subject: [PATCH] make custom prompts more compatible with p9k --- internal/p10k.zsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 255919a4..0c9948f8 100755 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -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" }