mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
Generate completion in the background
This commit is contained in:
parent
5b14c70c92
commit
8203214664
1 changed files with 13 additions and 10 deletions
|
|
@ -1,11 +1,14 @@
|
||||||
if (( $+commands[k9s] )); then
|
if (( ! $+commands[k9s] )); then
|
||||||
# If the completion file does not exist, generate it and then source it
|
return
|
||||||
# Otherwise, source it and regenerate in the background
|
|
||||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_k9s" ]]; then
|
|
||||||
k9s completion zsh | tee "$ZSH_CACHE_DIR/completions/_k9s" >/dev/null
|
|
||||||
source "$ZSH_CACHE_DIR/completions/_k9s"
|
|
||||||
else
|
|
||||||
source "$ZSH_CACHE_DIR/completions/_k9s"
|
|
||||||
k9s completion zsh | tee "$ZSH_CACHE_DIR/completions/_k9s" >/dev/null &|
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If the completion file does not exist, fake it and load it
|
||||||
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_k9s" ]]; then
|
||||||
|
typeset -g -A _comps
|
||||||
|
autoload -Uz _k9s
|
||||||
|
_comps[k9s]=_k9s
|
||||||
|
fi
|
||||||
|
|
||||||
|
# and then generate it in the background. On first completion,
|
||||||
|
# the actual completion file will be loaded.
|
||||||
|
k9s completion zsh >| "$ZSH_CACHE_DIR/completions/_k9s" &|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue