From 80f91af1711b077d2ea20aaae693dccfef714433 Mon Sep 17 00:00:00 2001 From: Aleksei Khudiakov Date: Sat, 8 Apr 2023 11:31:09 +1000 Subject: [PATCH] Move completions generation from goreleaser to Makefile --- .goreleaser.yml | 5 +---- Makefile | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index e7c823030..26277d3c5 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -9,10 +9,7 @@ before: hooks: - go mod tidy - make manpages GH_VERSION={{.Version}} - - mkdir -p ./share/bash-completion/completions ./share/fish/vendor_completions.d ./share/zsh/site-functions - - sh -c "go run ./cmd/gh completion -s bash > ./share/bash-completion/completions/gh" - - sh -c "go run ./cmd/gh completion -s fish > ./share/fish/vendor_completions.d/gh.fish" - - sh -c "go run ./cmd/gh completion -s zsh > ./share/zsh/site-functions/_gh" + - make completions builds: - <<: &build_defaults diff --git a/Makefile b/Makefile index 46d40a7a9..ffe694e19 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,13 @@ clean: script/build manpages: script/build @script/build $@ +.PHONY: completions +completions: + mkdir -p ./share/bash-completion/completions ./share/fish/vendor_completions.d ./share/zsh/site-functions + go run ./cmd/gh completion -s bash > ./share/bash-completion/completions/gh + go run ./cmd/gh completion -s fish > ./share/fish/vendor_completions.d/gh.fish + go run ./cmd/gh completion -s zsh > ./share/zsh/site-functions/_gh + # just a convenience task around `go test` .PHONY: test test: @@ -60,15 +67,22 @@ endif DESTDIR := prefix := /usr/local bindir := ${prefix}/bin -mandir := ${prefix}/share/man +datadir := ${prefix}/share +mandir := ${datadir}/man .PHONY: install -install: bin/gh manpages +install: bin/gh manpages completions install -d ${DESTDIR}${bindir} install -m755 bin/gh ${DESTDIR}${bindir}/ install -d ${DESTDIR}${mandir}/man1 install -m644 ./share/man/man1/* ${DESTDIR}${mandir}/man1/ + install -DT -m644 ./share/bash-completion/completions/gh ${DESTDIR}${datadir}/bash-completion/completions/gh + install -DT -m644 ./share/fish/vendor_completions.d/gh.fish ${DESTDIR}${datadir}/fish/vendor_completions.d/gh.fish + install -DT -m644 ./share/zsh/site-functions/_gh ${DESTDIR}${datadir}/zsh/site-functions/_gh .PHONY: uninstall uninstall: rm -f ${DESTDIR}${bindir}/gh ${DESTDIR}${mandir}/man1/gh.1 ${DESTDIR}${mandir}/man1/gh-*.1 + rm -f ${DESTDIR}${datadir}/bash-completion/completions/gh + rm -f ${DESTDIR}${datadir}/fish/vendor_completions.d/gh.fish + rm -f ${DESTDIR}${datadir}/zsh/site-functions/_gh