mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-19 14:01:57 +00:00
don't invoke custom prompt command if it doesn't resolve
This commit is contained in:
parent
8b8743c8ed
commit
473c5c45c3
1 changed files with 5 additions and 8 deletions
|
@ -697,14 +697,11 @@ prompt_custom() {
|
||||||
local segment_name="${3:u}"
|
local segment_name="${3:u}"
|
||||||
# Get content of custom segment
|
# Get content of custom segment
|
||||||
local command="POWERLEVEL9K_CUSTOM_${segment_name}"
|
local command="POWERLEVEL9K_CUSTOM_${segment_name}"
|
||||||
local segment_content="$(eval ${(P)command})"
|
local -a cmd=("${(@Q)${(z)${(P):-POWERLEVEL9K_CUSTOM_${segment_name}}}}")
|
||||||
# Note: this would be a better implementation. I'm keeping the old one in case anyone
|
whence $cmd[1] &>/dev/null || return
|
||||||
# relies on its quirks.
|
local content=$("$cmd[@]")
|
||||||
# local segment_content=$("${(@Q)${(z)${(P)command}}}")
|
[[ -n $content ]] || return
|
||||||
|
"$1_prompt_segment" "${0}_${3:u}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "CUSTOM_${segment_name}_ICON" 0 '' "$content"
|
||||||
if [[ -n $segment_content ]]; then
|
|
||||||
"$1_prompt_segment" "${0}_${3:u}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "CUSTOM_${segment_name}_ICON" 0 '' "$segment_content"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
|
|
Loading…
Reference in a new issue