class Peek < Formula
  desc "Multi-language code definition search powered by tree-sitter"
  homepage "https://github.com/owniai/peek"
  version "<%= version %>"
  license "MIT"

  on_macos do
    if Hardware::CPU.arm?
      url "https://github.com/owniai/peek/releases/download/v<%= version %>/peek-v<%= version %>-aarch64-apple-darwin.tar.gz"
      sha256 "<%= arm64_mac %>"
    end
    if Hardware::CPU.intel?
      url "https://github.com/owniai/peek/releases/download/v<%= version %>/peek-v<%= version %>-x86_64-apple-darwin.tar.gz"
      sha256 "<%= intel_mac %>"
    end
  end

  on_linux do
    if Hardware::CPU.arm?
      url "https://github.com/owniai/peek/releases/download/v<%= version %>/peek-v<%= version %>-aarch64-unknown-linux-gnu.tar.gz"
      sha256 "<%= arm64_linux %>"
    end
    if Hardware::CPU.intel?
      url "https://github.com/owniai/peek/releases/download/v<%= version %>/peek-v<%= version %>-x86_64-unknown-linux-gnu.tar.gz"
      sha256 "<%= intel_linux %>"
    end
  end

  def install
    bin.install "peek"
  end

  test do
    assert_match version.to_s, shell_output("#{bin}/peek --version")
  end
end
