fix(gh): preserve valid completion cache on failure (#14131)

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
Robby RussellandCarlo Sala authored and GitHub committed 2026-12-04 12:58:34 +01:00
1 parent 6527e23542
commit bb9193fa45
2 files changed
+6 -1

No files matched your search

+4 -1
View File
@@ -14,5 +14,8 @@ fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._gh"
zf_mv -f -- =( gh completion --shell zsh ) "$ZSH_CACHE_DIR/completions/_gh"
() {
gh completion --shell zsh >| "$1" && [[ -s "$1" ]] \
&& zf_mv -f -- "$1" "$ZSH_CACHE_DIR/completions/_gh"
} =(:) || return
} &|