mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-12-04 14:19:04 +01:00
fix(gh): preserve valid completion cache on failure (#14131)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
1 parent
6527e23542
commit
bb9193fa45
2 files changed
+6
-1
No files matched your search
@@ -18,3 +18,5 @@ plugin is loaded, which is usually when you start up a new terminal emulator.
|
|||||||
The cache is stored at:
|
The cache is stored at:
|
||||||
|
|
||||||
- `$ZSH_CACHE_DIR/completions/_gh` completions script
|
- `$ZSH_CACHE_DIR/completions/_gh` completions script
|
||||||
|
|
||||||
|
If an update fails, the last successfully generated completion script is kept.
|
||||||
@@ -14,5 +14,8 @@ fi
|
|||||||
zmodload -F zsh/files b:zf_mv
|
zmodload -F zsh/files b:zf_mv
|
||||||
() {
|
() {
|
||||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._gh"
|
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
|
||||||
} &|
|
} &|
|
||||||
Reference in new issue
Block a user