Merge pull request #13274 from cli/babakks/fix-zsh-completion-on-debian

chore: fix zsh completion on debian
This commit is contained in:
Babak K. Shandiz 2026-04-24 14:54:29 +01:00 committed by GitHub
commit ea7a2450cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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: