From 8bee0555b96cc7a6e44c02bb9318a1acffd3ee46 Mon Sep 17 00:00:00 2001 From: apainintheneck Date: Wed, 11 Dec 2024 23:24:22 -0800 Subject: [PATCH] cask/info: send missing args after removing openstruct This seems like it was a bug before the recent change to remove OpenStruct from `Homebrew::CLI::Args` but it was failing silently before. Now we pass the args to the `Cask::Info.info` method so that when they eventually reach the `Utils::Analytics.output_analytics` method they are present as expected. Example error fragment: ```console $ set -e HOMEBREW_NO_ANALYTICS $ brew info iterm2 --cask --verbose ==> iterm2: 3.5.10 (auto_updates) https://iterm2.com/ Installed /usr/local/Caskroom/iterm2/3.5.4 (91.7MB) From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/i/iterm2.rb ==> Name iTerm2 ==> Description Terminal emulator as alternative to Apple's Terminal app ==> Artifacts iTerm.app (App) Error: undefined method `analytics?' for an instance of Homebrew::CLI::Args /usr/local/Homebrew/Library/Homebrew/utils/analytics.rb:248:in `output_analytics' /usr/local/Homebrew/Library/Homebrew/utils/analytics.rb:342:in `cask_output' /usr/local/Homebrew/Library/Homebrew/cask/info.rb:39:in `info' ``` --- Library/Homebrew/cask/info.rb | 6 +++--- Library/Homebrew/cmd/info.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cask/info.rb b/Library/Homebrew/cask/info.rb index 16515d6659..3eaeabba45 100644 --- a/Library/Homebrew/cask/info.rb +++ b/Library/Homebrew/cask/info.rb @@ -31,12 +31,12 @@ module Cask output end - sig { params(cask: Cask).void } - def self.info(cask) + sig { params(cask: Cask, args: Homebrew::Cmd::Info::Args).void } + def self.info(cask, args:) puts get_info(cask) require "utils/analytics" - ::Utils::Analytics.cask_output(cask, args: Homebrew::CLI::Args.new) + ::Utils::Analytics.cask_output(cask, args:) end sig { params(cask: Cask).returns(String) } diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index 32fae43a1d..7abc703422 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -382,7 +382,7 @@ module Homebrew def info_cask(cask) require "cask/info" - Cask::Info.info(cask) + Cask::Info.info(cask, args:) end end end