diff --git a/.gitignore b/.gitignore index 461b6a5a0e2..25549846a52 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /share/fish/vendor_completions.d /share/man/man1 /share/zsh/site-functions +/share/zsh/vendor-completions /gh-cli .envrc /dist diff --git a/.goreleaser.yml b/.goreleaser.yml index b264b58e86c..9dd3c3e00bc 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -106,3 +106,8 @@ nfpms: #build:linux dst: "/usr/share/fish/vendor_completions.d/gh.fish" - src: "./share/zsh/site-functions/_gh" dst: "/usr/share/zsh/site-functions/_gh" + # Debian/Ubuntu zsh does not look in /usr/share/zsh/site-functions by default, + # so we also install to vendor-completions. See https://github.com/cli/cli/issues/13166 + - src: "./share/zsh/vendor-completions/_gh" + dst: "/usr/share/zsh/vendor-completions/_gh" + packager: deb diff --git a/Makefile b/Makefile index fb8bf40911b..c3b18f31332 100644 --- a/Makefile +++ b/Makefile @@ -33,10 +33,14 @@ manpages: script/build$(EXE) .PHONY: completions completions: bin/gh$(EXE) - mkdir -p ./share/bash-completion/completions ./share/fish/vendor_completions.d ./share/zsh/site-functions + mkdir -p ./share/bash-completion/completions ./share/fish/vendor_completions.d ./share/zsh/site-functions ./share/zsh/vendor-completions bin/gh$(EXE) completion -s bash > ./share/bash-completion/completions/gh bin/gh$(EXE) completion -s fish > ./share/fish/vendor_completions.d/gh.fish bin/gh$(EXE) completion -s zsh > ./share/zsh/site-functions/_gh + # On Debian/Ubuntu the default zsh fpath does not include /usr/share/zsh/site-functions + # but does include /usr/share/zsh/vendor-completions, so we ship both paths in our + # .deb and .rpm packages. See https://github.com/cli/cli/issues/13166 + cp ./share/zsh/site-functions/_gh ./share/zsh/vendor-completions/_gh .PHONY: lint lint: