Skip to content

Commit

Permalink
feat(mods): completions
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 committed Aug 30, 2023
1 parent f7a8e9d commit 1dcca86
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions goreleaser-mods.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json

variables:
main: ""
aur_project_name: ""
Expand All @@ -10,6 +12,18 @@ variables:
brew_commit_author_name: "Toby Padilla"
brew_commit_author_email: "[email protected]"

before:
hooks:
- go mod tidy
- rm -rf completions
- mkdir completions
- cmd: sh -c 'go run go run . completion "bash" >./completions/{{ .ProjectName }}.bash'
env: ["__MODS_CMP_ENABLED=1"]
- cmd: sh -c 'go run go run . completion "zsh" >./completions/{{ .ProjectName }}.zsh'
env: ["__MODS_CMP_ENABLED=1"]
- cmd: sh -c 'go run go run . completion "fish" >./completions/{{ .ProjectName }}.fish'
env: ["__MODS_CMP_ENABLED=1"]

gomod:
proxy: true

Expand Down Expand Up @@ -46,13 +60,21 @@ archives:
files:
- README*
- LICENSE*
- completions/*

nfpms:
- vendor: charmbracelet
homepage: "{{ .Var.homepage }}"
maintainer: "{{ .Var.maintainer }}"
file_name_template: "{{ .ConventionalFileName }}"
license: MIT
contents:
- src: ./completions/{{ .ProjectName }}.bash
dst: /etc/bash_completion.d/{{ .ProjectName }}
- src: ./completions/{{ .ProjectName }}.fish
dst: /usr/share/fish/vendor_completions.d/{{ .ProjectName }}.fish
- src: ./completions/{{ .ProjectName }}.zsh
dst: /usr/share/zsh/site-functions/_{{ .ProjectName }}
formats:
- apk
- deb
Expand All @@ -78,6 +100,10 @@ brews:
email: "{{ .Var.brew_commit_author_email }}"
homepage: "{{ .Var.homepage }}"
description: "{{ .Var.description }}"
extra_install: |-
bash_completion.install "completions/{{ .ProjectName }}.bash" => "{{ .ProjectName }}"
zsh_completion.install "completions/{{ .ProjectName }}.zsh" => "_{{ .ProjectName }}"
fish_completion.install "completions/{{ .ProjectName }}.fish"
scoops:
- repository:
Expand Down Expand Up @@ -105,6 +131,13 @@ aurs:
# license
mkdir -p "${pkgdir}/usr/share/licenses/{{ .ProjectName }}/"
install -Dm644 ./LICENSE* "${pkgdir}/usr/share/licenses/{{ .ProjectName }}/"
# completions
mkdir -p "${pkgdir}/usr/share/bash-completion/completions/"
mkdir -p "${pkgdir}/usr/share/zsh/site-functions/"
mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/"
install -Dm644 "./completions/{{ .ProjectName }}.bash" "${pkgdir}/usr/share/bash-completion/completions/{{ .ProjectName }}"
install -Dm644 "./completions/{{ .ProjectName }}.zsh" "${pkgdir}/usr/share/zsh/site-functions/_{{ .ProjectName }}"
install -Dm644 "./completions/{{ .ProjectName }}.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/{{ .ProjectName }}.fish"
nix:
- repository:
Expand All @@ -114,6 +147,8 @@ nix:
homepage: "{{ .Var.homepage }}"
description: "{{ .Var.description }}"
license: mit
extra_install: |-
installShellCompletion ./completions/*
winget:
- publisher: charmbracelet
Expand Down

0 comments on commit 1dcca86

Please sign in to comment.