mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
make custom prompts more compatible with p9k
This commit is contained in:
parent
08026f5071
commit
cb1f6c4815
1 changed files with 4 additions and 3 deletions
|
@ -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"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue