Skip to content

Commit

Permalink
feat: Add completion generation
Browse files Browse the repository at this point in the history
  • Loading branch information
NoUseFreak committed Dec 13, 2023
1 parent 07643de commit 8d183fc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
wd
dist/
manpages
completions
22 changes: 17 additions & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
env:
Expand All @@ -16,6 +11,7 @@ before:
hooks:
- go mod tidy
- ./scripts/manpages.sh
- ./scripts/completions.sh

builds:
- env:
Expand Down Expand Up @@ -45,6 +41,7 @@ archives:
- README.md
- LICENSE
- manpages/*
- completions/*

changelog:
sort: asc
Expand Down Expand Up @@ -89,6 +86,9 @@ brews:
install: |-
bin.install "{{ .ProjectName }}"
extra_install: |-
bash_completion.install "completions/warpdir.bash" => "warpdir"
zsh_completion.install "completions/warpdir.zsh" => "_warpdir"
fish_completion.install "completions/warpdir.fish"
man1.install "manpages/warpdir.1.gz"
nfpms:
Expand All @@ -110,6 +110,18 @@ nfpms:
dst: /usr/share/man/man1/warpdir.1.gz
file_info:
mode: 0644
- src: ./completions/warpdir.bash
dst: /usr/share/bash-completion/completions/warpdir
file_info:
mode: 0644
- src: ./completions/warpdir.fish
dst: /usr/share/fish/vendor_completions.d/warpdir.fish
file_info:
mode: 0644
- src: ./completions/warpdir.zsh
dst: /usr/share/zsh/vendor-completions/_warpdir
file_info:
mode: 0644
formats:
- apk
- deb
Expand Down
7 changes: 7 additions & 0 deletions scripts/completions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e
rm -rf completions
mkdir completions
for sh in bash zsh fish; do
go run main.go completion "$sh" >"completions/warpdir.$sh"
done

0 comments on commit 8d183fc

Please sign in to comment.