mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-11-30 20:33:14 +01:00
feat(fizzy): add completion plugin (#14297)
This commit is contained in:
1 parent
32726ad0a5
commit
387dfe0bfb
2 files changed
+42
No files matched your search
@@ -0,0 +1,24 @@
|
||||
# Autocompletion for the Fizzy CLI (fizzy).
|
||||
if (( ! $+commands[fizzy] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion isn't registered yet, autoload it and bind it to `fizzy`.
|
||||
# Otherwise, compinit will have already done that from the cache.
|
||||
if [[ -z ${_comps[fizzy]-} ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _fizzy
|
||||
_comps[fizzy]=_fizzy
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv || return
|
||||
() {
|
||||
local cache_file="$ZSH_CACHE_DIR/completions/_fizzy"
|
||||
local temp_file
|
||||
temp_file=$(mktemp "$ZSH_CACHE_DIR/completions/._fizzy.XXXXXXXX") || return
|
||||
if command fizzy completion zsh >| "$temp_file" && [[ -s "$temp_file" ]] &&
|
||||
zf_mv -f -- "$temp_file" "$cache_file"; then
|
||||
return
|
||||
fi
|
||||
rm -f -- "$temp_file"
|
||||
} &|
|
||||
Reference in new issue
Block a user