summaryrefslogtreecommitdiff
path: root/plugins/gh/gh.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/gh/gh.plugin.zsh')
-rw-r--r--plugins/gh/gh.plugin.zsh13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/gh/gh.plugin.zsh b/plugins/gh/gh.plugin.zsh
new file mode 100644
index 000000000..8e055ec35
--- /dev/null
+++ b/plugins/gh/gh.plugin.zsh
@@ -0,0 +1,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
+