Skip to content

Commit

Permalink
Merge pull request #169 from nao1215/nchika/shipping-completion
Browse files Browse the repository at this point in the history
Feat: Integrate completions into Homebrew formula (Issue #168)
  • Loading branch information
nao1215 authored Aug 10, 2024
2 parents 9c33971 + 406d3a8 commit 86c37d1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
gup
dist
cover.*
/completions
24 changes: 23 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ before:
hooks:
- go mod tidy
- go generate ./...
- ./scripts/completions.sh
builds:
- main: .
ldflags:
Expand All @@ -20,6 +21,8 @@ archives:
format_overrides:
- goos: windows
format: zip
files:
- completions/*
checksum:
name_template: "checksums.txt"
snapshot:
Expand All @@ -31,14 +34,27 @@ changelog:
- "^docs:"
- "^test:"
nfpms:
- maintainer: Naohiro CHIKAMATSU <[email protected]>
- maintainer: 'Naohiro CHIKAMATSU <[email protected]>'
description: gup - Update binaries installed by 'go install'
homepage: https://github.com/nao1215/gup
license: Apache License 2.0
formats:
- deb
- rpm
- apk
contents:
- src: ./completions/gup.bash
dst: /usr/share/bash-completion/completions/gup
file_info:
mode: 0644
- src: ./completions/gup.fish
dst: /usr/share/fish/vendor_completions.d/gup.fish
file_info:
mode: 0644
- src: ./completions/gup.zsh
dst: /usr/share/zsh/vendor-completions/_gup
file_info:
mode: 0644
brews:
- name: gup
description: gup - Update binaries installed by 'go install'
Expand All @@ -47,3 +63,9 @@ brews:
owner: nao1215
name: homebrew-tap
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
# Ref. https://carlosbecker.com/posts/golang-completions-cobra/
install: |-
bin.install "gup"
bash_completion.install "completions/gup.bash" => "gup"
zsh_completion.install "completions/gup.zsh" => "gup"
fish_completion.install "completions/gup.fish"
10 changes: 10 additions & 0 deletions scripts/completions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
# scripts/completions.sh
set -eux

rm -rf completions
mkdir completions

for sh in bash zsh fish; do
go run main.go completion "$sh" >"completions/gup.$sh"
done

0 comments on commit 86c37d1

Please sign in to comment.