summaryrefslogtreecommitdiff
path: root/plugins/gh/gh.plugin.zsh
blob: 8e055ec3535170e53417a68e01dc0d9e0fc2e93d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# Autocompletion for the GitHub CLI (gh).

if (( $+commands[gh] )); then
  if [[ ! -r "$ZSH_CACHE_DIR/gh_version" \
    || "$(gh --version)" != "$(< "$ZSH_CACHE_DIR/gh_version")"
    || ! -f "$ZSH/plugins/gh/_gh" ]]; then
    gh completion --shell zsh > $ZSH/plugins/gh/_gh
    gh --version > $ZSH_CACHE_DIR/gh_version
  fi
  autoload -Uz _gh
  _comps[gh]=_gh
fi