Skip to content

Commit

Permalink
Merge pull request #309 from planetscale/fatih-include-shell-completions
Browse files Browse the repository at this point in the history
completion: include completions in archives, linux packages and homebrew
  • Loading branch information
fatih committed Jun 16, 2021
2 parents 7bdbee7 + 866bf72 commit b3f5649
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Expand Up @@ -11,7 +11,5 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

dist/
completions/
18 changes: 18 additions & 0 deletions .goreleaser.yml
@@ -1,6 +1,10 @@
project_name: pscale
release:
prerelease: auto # don't publish release with -rc1,-pre, etc suffixes
before:
hooks:
- go mod tidy
- ./script/completions
builds:
- env:
- CGO_ENABLED=0
Expand Down Expand Up @@ -29,6 +33,13 @@ nfpms:
description: The PlanetScale CLI
homepage: https://github.com/planetscale/cli
license: Apache 2.0
contents:
- src: ./completions/pscale.bash
dst: /etc/bash_completion.d/pscale
- src: ./completions/pscale.fish
dst: /usr/share/fish/completions/pscale.fish
- src: ./completions/pscale.zsh
dst: /usr/local/share/zsh/site-functions/_pscale
formats:
- deb
- rpm
Expand All @@ -50,12 +61,19 @@ brews:
system "#{bin}/pscale --version"
install: |
bin.install "pscale"
bash_completion.install "completions/pscale.bash" => "pscale"
zsh_completion.install "completions/pscale.zsh" => "_pscale"
fish_completion.install "completions/pscale.fish"
archives:
- replacements:
darwin: macOS
format_overrides:
- goos: windows
format: zip
files:
- README.md
- LICENSE
- completions/*
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
Expand Down
10 changes: 10 additions & 0 deletions script/completions
@@ -0,0 +1,10 @@
#!/bin/sh

set -e

rm -rf completions
mkdir -p completions

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

0 comments on commit b3f5649

Please sign in to comment.