From 4d64c9000241456d79dd5a520a50fa28ea006a68 Mon Sep 17 00:00:00 2001 From: subash Date: Mon, 3 Oct 2022 17:19:54 +1100 Subject: [PATCH] chore: generate brew completions --- .gitignore | 1 + .goreleaser.yaml | 10 ++++++++++ scripts/completions.sh | 8 ++++++++ 3 files changed, 19 insertions(+) create mode 100755 scripts/completions.sh diff --git a/.gitignore b/.gitignore index 50598ae..28967ec 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ go.work safebox dist/ +completions/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml index dd436cd..2008a04 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -2,6 +2,7 @@ before: hooks: - go mod tidy - go test ./... + - ./scripts/completions.sh builds: - binary: safebox env: @@ -14,6 +15,10 @@ builds: checksum: name_template: 'checksums.txt' +archives: + - files: + - completions/* + snapshot: name_template: "{{ incpatch .Version }}-next" @@ -32,6 +37,11 @@ brews: license: "MIT" test: | system "#{bin}/safebox --version" + install: | + bin.install "safebox" + bash_completion.install "completions/safebox.bash" => "safebox" + zsh_completion.install "completions/safebox.zsh" => "_safebox" + fish_completion.install "completions/safebox.fish" tap: owner: adikari name: homebrew-taps diff --git a/scripts/completions.sh b/scripts/completions.sh new file mode 100755 index 0000000..1e36c98 --- /dev/null +++ b/scripts/completions.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +rm -rf completions +mkdir completions + +for sh in bash zsh fish; do + go run main.go completion "$sh" >"completions/safebox.$sh" +done