summaryrefslogtreecommitdiff
path: root/plugins/tailscale/tailscale.plugin.zsh
blob: e0e011196233f31890a9d7ec4948e71e72770976 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
if (( ! $+commands[tailscale] && ! $+aliases[tailscale] )); then
  return
fi

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

  if (( $+commands[tailscale] )); then
    _comps[tailscale]=_tailscale
  elif (( $+aliases[tailscale] )); then
    _comps[${aliases[tailscale]:t}]=_tailscale
  fi
fi

tailscale completion zsh >| "$ZSH_CACHE_DIR/completions/_tailscale" &|