From 1dcca8620da49adec7b4be59a27e3d04289682dc Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Wed, 30 Aug 2023 16:54:14 +0000 Subject: [PATCH] feat(mods): completions Signed-off-by: Carlos Alexandro Becker --- goreleaser-mods.yaml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/goreleaser-mods.yaml b/goreleaser-mods.yaml index 47e497c..3d66457 100644 --- a/goreleaser-mods.yaml +++ b/goreleaser-mods.yaml @@ -1,3 +1,5 @@ +# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json + variables: main: "" aur_project_name: "" @@ -10,6 +12,18 @@ variables: brew_commit_author_name: "Toby Padilla" brew_commit_author_email: "toby@charm.sh" +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 @@ -46,6 +60,7 @@ archives: files: - README* - LICENSE* + - completions/* nfpms: - vendor: charmbracelet @@ -53,6 +68,13 @@ nfpms: 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 @@ -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: @@ -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: @@ -114,6 +147,8 @@ nix: homepage: "{{ .Var.homepage }}" description: "{{ .Var.description }}" license: mit + extra_install: |- + installShellCompletion ./completions/* winget: - publisher: charmbracelet