mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-27 03:14:56 +01:00
fix(git prompt): register async handler on wrapper invocation
This commit is contained in:
parent
45dd7d006a
commit
7ae58e73b0
1 changed files with 4 additions and 0 deletions
|
|
@ -147,12 +147,16 @@ local _style
|
||||||
if zstyle -t ':omz:alpha:lib:git' async-prompt \
|
if zstyle -t ':omz:alpha:lib:git' async-prompt \
|
||||||
|| { is-at-least 5.0.6 && zstyle -T ':omz:alpha:lib:git' async-prompt }; then
|
|| { is-at-least 5.0.6 && zstyle -T ':omz:alpha:lib:git' async-prompt }; then
|
||||||
function git_prompt_info() {
|
function git_prompt_info() {
|
||||||
|
# Support wrapper calls like $(_my_git_prompt_info) by lazily registering
|
||||||
|
# the async handler on first invocation.
|
||||||
|
_omz_register_handler _omz_git_prompt_info
|
||||||
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}" ]]; then
|
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}" ]]; then
|
||||||
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}"
|
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_prompt_status() {
|
function git_prompt_status() {
|
||||||
|
_omz_register_handler _omz_git_prompt_status
|
||||||
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}" ]]; then
|
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}" ]]; then
|
||||||
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}"
|
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue