Skip to content

Commit 875f062

Browse files
authored
feat: add completions script for goreleaser (#13)
Signed-off-by: Erkan Zileli <erkan.zileli@trendyol.com>
1 parent 3d38d8f commit 875f062

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ kink
2020

2121

2222
dist/
23+
completions/

.goreleaser.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ before:
1111
hooks:
1212
- go mod tidy
1313
- go mod download
14+
- ./scripts/completions.sh
15+
1416
builds:
1517
- id: linux-amd64
1618
binary: kink
@@ -86,6 +88,9 @@ brews:
8688
- name: git
8789
install: |-
8890
bin.install "kink"
91+
bash_completion.install "completions/kink.bash" => "kink"
92+
zsh_completion.install "completions/kink.zsh" => "_kink"
93+
fish_completion.install "completions/kink.fish"
8994
9095
archives:
9196
- replacements:
@@ -95,10 +100,15 @@ archives:
95100
386: i386
96101
amd64: x86_64
97102
name_template: '{{.ProjectName}}_{{.Version}}_{{.Os}}-{{.Arch}}'
103+
files:
104+
- completions/*
105+
98106
checksum:
99107
name_template: "{{ .ProjectName }}_checksums.txt"
108+
100109
snapshot:
101110
name_template: SNAPSHOT-{{.ShortCommit}}
111+
102112
changelog:
103113
sort: asc
104114
filters:
@@ -108,6 +118,7 @@ changelog:
108118
- 'README'
109119
- Merge pull request
110120
- Merge branch
121+
111122
release:
112123
github:
113124
owner: Trendyol

scripts/completions.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
set -e
3+
rm -rf completions
4+
mkdir completions
5+
for sh in bash zsh fish; do
6+
go run main.go completion "$sh" >"completions/kink.$sh"
7+
done

0 commit comments

Comments
 (0)