2021-05-03 16:35:28 +02:00
|
|
|
# Autocompletion for the GitHub CLI (gh).
|
|
|
|
if (( $+commands[gh] )); then
|
2021-09-15 18:18:25 +02: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 16:35:28 +02:00
|
|
|
fi
|
2021-09-15 18:18:25 +02:00
|
|
|
|
|
|
|
declare -A _comps
|
2021-05-03 16:35:28 +02:00
|
|
|
autoload -Uz _gh
|
|
|
|
_comps[gh]=_gh
|
2021-09-15 18:18:25 +02:00
|
|
|
|
|
|
|
unset ver ver_file comp_file
|
2021-05-03 16:35:28 +02:00
|
|
|
fi
|
|
|
|
|