Skip to content

Commit ea7a245

Browse files
authored
Merge pull request cli#13274 from cli/babakks/fix-zsh-completion-on-debian
chore: fix zsh completion on debian
2 parents 2c1f5b2 + de6a9eb commit ea7a245

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/share/fish/vendor_completions.d
44
/share/man/man1
55
/share/zsh/site-functions
6+
/share/zsh/vendor-completions
67
/gh-cli
78
.envrc
89
/dist

.goreleaser.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,8 @@ nfpms: #build:linux
106106
dst: "/usr/share/fish/vendor_completions.d/gh.fish"
107107
- src: "./share/zsh/site-functions/_gh"
108108
dst: "/usr/share/zsh/site-functions/_gh"
109+
# Debian/Ubuntu zsh does not look in /usr/share/zsh/site-functions by default,
110+
# so we also install to vendor-completions. See https://github.com/cli/cli/issues/13166
111+
- src: "./share/zsh/vendor-completions/_gh"
112+
dst: "/usr/share/zsh/vendor-completions/_gh"
113+
packager: deb

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ manpages: script/build$(EXE)
3333

3434
.PHONY: completions
3535
completions: bin/gh$(EXE)
36-
mkdir -p ./share/bash-completion/completions ./share/fish/vendor_completions.d ./share/zsh/site-functions
36+
mkdir -p ./share/bash-completion/completions ./share/fish/vendor_completions.d ./share/zsh/site-functions ./share/zsh/vendor-completions
3737
bin/gh$(EXE) completion -s bash > ./share/bash-completion/completions/gh
3838
bin/gh$(EXE) completion -s fish > ./share/fish/vendor_completions.d/gh.fish
3939
bin/gh$(EXE) completion -s zsh > ./share/zsh/site-functions/_gh
40+
# On Debian/Ubuntu the default zsh fpath does not include /usr/share/zsh/site-functions
41+
# but does include /usr/share/zsh/vendor-completions, so we ship both paths in our
42+
# .deb and .rpm packages. See https://github.com/cli/cli/issues/13166
43+
cp ./share/zsh/site-functions/_gh ./share/zsh/vendor-completions/_gh
4044

4145
.PHONY: lint
4246
lint:

0 commit comments

Comments
 (0)