# typed: false
# frozen_string_literal: true

# This file was generated by GoReleaser. DO NOT EDIT.
class TektoncdCli < Formula
  desc "Tekton CLI - The command line interface for interacting with Tekton"
  homepage "https://github.com/tektoncd/cli"
  version "0.23.0"

  on_macos do
    if Hardware::CPU.arm?
      url "https://github.com/tektoncd/cli/releases/download/v0.23.0/tkn_0.23.0_Darwin_arm64.tar.gz"
      sha256 "48a5c9d69528d625e76477f596fc4749472646c19aff65ce88392ff91f60a226"

      def install
        bin.install_symlink "tkn" => "kubectl-tkn"
        bin.install "tkn" => "tkn"
        output = Utils.popen_read("SHELL=bash #{bin}/tkn completion bash")
        (bash_completion/"tkn").write output
        output = Utils.popen_read("SHELL=zsh #{bin}/tkn completion zsh")
        (zsh_completion/"_tkn").write output
        prefix.install_metafiles
      end
    end
    if Hardware::CPU.intel?
      url "https://github.com/tektoncd/cli/releases/download/v0.23.0/tkn_0.23.0_Darwin_x86_64.tar.gz"
      sha256 "6191ed4070deef0cb73f47f2ee193746e0c4d93dc9def8fe5adbfbdd436dac05"

      def install
        bin.install_symlink "tkn" => "kubectl-tkn"
        bin.install "tkn" => "tkn"
        output = Utils.popen_read("SHELL=bash #{bin}/tkn completion bash")
        (bash_completion/"tkn").write output
        output = Utils.popen_read("SHELL=zsh #{bin}/tkn completion zsh")
        (zsh_completion/"_tkn").write output
        prefix.install_metafiles
      end
    end
  end

  on_linux do
    if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
      url "https://github.com/tektoncd/cli/releases/download/v0.23.0/tkn_0.23.0_Linux_arm64.tar.gz"
      sha256 "3308e7b3d620b4479b9c79f8cb6775b1b53b951ef0810392e213308d961ebd3e"

      def install
        bin.install_symlink "tkn" => "kubectl-tkn"
        bin.install "tkn" => "tkn"
        output = Utils.popen_read("SHELL=bash #{bin}/tkn completion bash")
        (bash_completion/"tkn").write output
        output = Utils.popen_read("SHELL=zsh #{bin}/tkn completion zsh")
        (zsh_completion/"_tkn").write output
        prefix.install_metafiles
      end
    end
    if Hardware::CPU.intel?
      url "https://github.com/tektoncd/cli/releases/download/v0.23.0/tkn_0.23.0_Linux_x86_64.tar.gz"
      sha256 "f7a085ec863a6eda24f7944d5d03bf3bcd2476ffb6340bf6e91ba25bfd3e0ab7"

      def install
        bin.install_symlink "tkn" => "kubectl-tkn"
        bin.install "tkn" => "tkn"
        output = Utils.popen_read("SHELL=bash #{bin}/tkn completion bash")
        (bash_completion/"tkn").write output
        output = Utils.popen_read("SHELL=zsh #{bin}/tkn completion zsh")
        (zsh_completion/"_tkn").write output
        prefix.install_metafiles
      end
    end
  end

  test do
    system "#{bin}/tkn", "version"
  end
end
