From 54709050f6ce64e3d0d94bc926085d08e06aeb57 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Thu, 7 Nov 2024 09:11:00 -0800 Subject: [PATCH] Try matching key type --- Library/Homebrew/cmd/outdated.rb | 10 +++------- .../test/support/helper/cmd/brew-verify-undefined.rb | 0 2 files changed, 3 insertions(+), 7 deletions(-) mode change 100755 => 100644 Library/Homebrew/test/support/helper/cmd/brew-verify-undefined.rb diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb index 17232e8dd4a24..d17074833faa2 100644 --- a/Library/Homebrew/cmd/outdated.rb +++ b/Library/Homebrew/cmd/outdated.rb @@ -62,13 +62,12 @@ def run end json = { - "formulae" => json_info(formulae), - "casks" => json_info(casks), + formulae: json_info(formulae), + casks: json_info(casks), } puts JSON.pretty_generate(json) outdated = formulae + casks - else outdated = if args.formula? outdated_formulae @@ -170,10 +169,7 @@ def json_version(version) "v1" => :v1, "v2" => :v2, } - - raise UsageError, "invalid JSON version: #{version}" unless version_hash.include?(version) - - version_hash[version] + version_hash.fetch(version) { raise UsageError, "invalid JSON version: #{version}" } end sig { returns(T::Array[Formula]) } diff --git a/Library/Homebrew/test/support/helper/cmd/brew-verify-undefined.rb b/Library/Homebrew/test/support/helper/cmd/brew-verify-undefined.rb old mode 100755 new mode 100644