summaryrefslogtreecommitdiff
path: root/plugins/fluxcd/fluxcd.plugin.zsh
blob: d30866a065033eec6a8c69ab009f3311e6fd0373 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Autocompletion for the FluxCD CLI (flux).
if (( ! $+commands[flux] )); then
  return
fi

# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `flux`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_flux" ]]; then
  typeset -g -A _comps
  autoload -Uz _flux
  _comps[flux]=_flux
fi

flux completion zsh >| "$ZSH_CACHE_DIR/completions/_flux" &|