chore: fix zsh completion on debian

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Babak K. Shandiz 2026-04-24 09:59:09 +01:00
parent 352a00e83c
commit de6a9eb3e4
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E
3 changed files with 11 additions and 1 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
/share/fish/vendor_completions.d
/share/man/man1
/share/zsh/site-functions
/share/zsh/vendor-completions
/gh-cli
.envrc
/dist

View file

@ -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

View file

@ -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: