2021-05-03 14:35:28 +00:00
|
|
|
# Autocompletion for the GitHub CLI (gh).
|
|
|
|
if (( $+commands[gh] )); then
|
2021-09-15 16:18:25 +00:00
|
|
|
ver="$(gh --version)"
|
|
|
|
ver_file="$ZSH_CACHE_DIR/gh_version"
|
|
|
|
comp_file="$ZSH/plugins/gh/_gh"
|
|
|
|
|
|
|
|
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
|
|
|
|
gh completion --shell zsh >| "$comp_file"
|
|
|
|
echo "$ver" >| "$ver_file"
|
2021-05-03 14:35:28 +00:00
|
|
|
fi
|
2021-09-15 16:18:25 +00:00
|
|
|
|
|
|
|
declare -A _comps
|
2021-05-03 14:35:28 +00:00
|
|
|
autoload -Uz _gh
|
|
|
|
_comps[gh]=_gh
|
2021-09-15 16:18:25 +00:00
|
|
|
|
|
|
|
unset ver ver_file comp_file
|
2021-05-03 14:35:28 +00:00
|
|
|
fi
|
|
|
|
|