class Tempo < Formula
  desc "Automatic project time tracking CLI tool with beautiful terminal interface"
  homepage "https://github.com/own-path/tempo"
  url "https://github.com/own-path/tempo/archive/refs/tags/v0.1.0.tar.gz"
  sha256 "7ec25e48d7e89dd01961099bcb5fdb14740c3354d881228b1b373139faad3155"
  license "MIT"
  head "https://github.com/own-path/tempo.git", branch: "main"

  depends_on "rust" => :build

  def install
    system "cargo", "install", *std_cargo_args

    # Install shell completions
    generate_completions_from_executable(bin/"tempo", "completions")

    # Install shell hooks
    (share/"tempo").install "shell-hooks"

    # Install examples and docs
    doc.install "README.md", "CHANGELOG.md", "examples"
  end

  def post_install
    puts "🎉 Tempo has been installed successfully!"
    puts ""
    puts "To get started:"
    puts "  1. Start the daemon: tempo start"
    puts "  2. Check status: tempo status"
    puts "  3. Begin tracking: tempo session start"
    puts ""
    puts "For shell integration (optional):"
    puts "  # Bash/Zsh"
    puts "  echo 'source #{share}/tempo/shell-hooks/tempo-hook.sh' >> ~/.bashrc"
    puts "  echo 'source #{share}/tempo/shell-hooks/tempo-hook.sh' >> ~/.zshrc"
    puts ""
    puts "  # Fish"
    puts "  echo 'source #{share}/tempo/shell-hooks/tempo-hook.fish' >> ~/.config/fish/config.fish"
    puts ""
    puts "  # PowerShell"
    puts "  echo '. #{share}/tempo/shell-hooks/tempo-hook.ps1' >> $PROFILE"
    puts ""
    puts "Documentation: #{doc}"
  end

  test do
    system "#{bin}/tempo", "--version"
    system "#{bin}/tempo", "status"
  end
end
