# This file was generated by GoReleaser. DO NOT EDIT.
{{- /* See: https://docs.brew.sh/Cask-Cookbook#stanza-order */}}
cask "{{ .Name }}" do
  {{- with .CustomBlock -}}
  {{ range (split .) }}
  {{ . }}
  {{- end }}

  {{ end }}
  version "{{ .Version }}"

  {{ if .MacOSPackages }}
  on_macos do
  {{- include "macos_packages" . | indent 2 }}
  end
  {{- end }}
  {{- if .LinuxPackages }}
  on_linux do
  {{- include "linux_packages" . | indent 2 }}
  end
  {{- end }}

  name "{{ .Name }}"
  desc "{{ .Description }}"
  homepage "{{ .Homepage }}"

  livecheck do
    skip "Auto-generated on release."
  end

  {{- with .Conflicts }}
  {{ conflicts . }}
  {{- end }}

  {{- with .Dependencies }}
  {{ depends  . }}
  {{- end }}

  {{ with and (not .HasOnlyBinaryPkgs) .Binaries }}
  {{- range . }}
  binary "{{ . }}"
  {{- end }}
  {{- end }}
  {{- range .Manpages }}
  manpage "{{ .}}"
  {{- end }}
  {{- with .Completions.Bash }}
  bash_completion "{{ . }}"
  {{- end }}
  {{- with .Completions.Fish }}
  fish_completion "{{ . }}"
  {{- end }}
  {{- with .Completions.Zsh }}
  zsh_completion "{{ . }}"
  {{- end }}

  {{ with .Service -}}
  service "{{ . }}"
  {{- end }}

  {{ with .Hooks.Pre.Install -}}
  preflight do
    {{- range (split .) }}
    {{ . }}
    {{- end }}
  end
  {{- end }}

  {{ with .Hooks.Post.Install -}}
  postflight do
    {{- range (split .) }}
    {{ . }}
    {{- end }}
  end
  {{- end }}

  {{- /*
    generate_completions_from_executable must come after postflight so that
    any setup done in postflight (e.g. removing the macOS quarantine attribute)
    runs before Homebrew tries to execute the binary to generate completions.
    See: https://github.com/goreleaser/goreleaser/issues/5958
  */}}
  {{- with generateCompletions .GenerateCompletionsFromExecutable }}
  {{ . }}
  {{- end }}

  {{ with .Hooks.Pre.Uninstall -}}
  uninstall_preflight do
    {{- range (split .) }}
    {{ . }}
    {{- end }}
  end
  {{- end }}

  {{ with .Hooks.Post.Uninstall -}}
  uninstall_postflight do
    {{- range (split .) }}
    {{ . }}
    {{- end }}
  end
  {{- end }}

  {{ uninstall .Uninstall }}

  {{ zap .Zap }}

  {{- with .Caveats }}

  caveats <<~EOS
    {{- range (split .) }}
    {{ . -}}
    {{- end }}
  EOS
  {{- end }}
{{- /*
  No blank line before `end`: rubocop's Layout/EmptyLinesAroundBlockBody
  rejects one, and it fired on every Cask GoReleaser generated.
*/}}
end
