dev-cmd/cat: add require "formula"

Fixes

    ❯ HOMEBREW_BAT=1 brew cat xz
    Error: uninitialized constant Kernel::Formula
    Warning: Removed Sorbet lines from backtrace!
    Rerun with `--verbose` to see the original backtrace
    /opt/homebrew/Library/Homebrew/extend/kernel.rb:445:in 'block in <module:Kernel>'
    /opt/homebrew/Library/Homebrew/dev-cmd/cat.rb:33:in 'block in Homebrew::DevCmd::Cat#run'
    /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.4.5/lib/ruby/3.4.0/fileutils.rb:241:in 'Dir.chdir'
    /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.4.5/lib/ruby/3.4.0/fileutils.rb:241:in 'FileUtils#cd'
    /opt/homebrew/Library/Homebrew/dev-cmd/cat.rb:29:in 'Homebrew::DevCmd::Cat#run'
    /opt/homebrew/Library/Homebrew/brew.rb:113:in '<main>'
    Please report this issue:
      https://docs.brew.sh/Troubleshooting
This commit is contained in:
Carlo Cabrera 2025-08-02 01:30:01 +08:00 committed by Carlo Cabrera
parent d746234dcd
commit a9e88acab4
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -30,6 +30,7 @@ module Homebrew
pager = if Homebrew::EnvConfig.bat? pager = if Homebrew::EnvConfig.bat?
ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path
ENV["BAT_THEME"] = Homebrew::EnvConfig.bat_theme ENV["BAT_THEME"] = Homebrew::EnvConfig.bat_theme
require "formula"
ensure_formula_installed!( ensure_formula_installed!(
"bat", "bat",
reason: "displaying <formula>/<cask> source", reason: "displaying <formula>/<cask> source",