From d22554cda2bc9714f93a8ed53930c0682f53dd88 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Tue, 26 Nov 2024 13:45:50 -0500 Subject: [PATCH] formula: expose inreplace global parameter --- Library/Homebrew/formula.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 0b3c00e51ccb1..98f6bc8814140 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2942,17 +2942,18 @@ def install; end after: T.nilable(T.any(Pathname, String, Symbol)), old_audit_result: T.nilable(T::Boolean), audit_result: T::Boolean, + global: T::Boolean, block: T.nilable(T.proc.params(s: StringInreplaceExtension).void), ).void } - def inreplace(paths, before = nil, after = nil, old_audit_result = nil, audit_result: true, &block) + def inreplace(paths, before = nil, after = nil, old_audit_result = nil, audit_result: true, global: true, &block) # NOTE: must check for `#nil?` and not `#blank?`, or else `old_audit_result = false` will not call `odeprecated`. unless old_audit_result.nil? odeprecated "inreplace(paths, before, after, #{old_audit_result})", "inreplace(paths, before, after, audit_result: #{old_audit_result})" audit_result = old_audit_result end - Utils::Inreplace.inreplace(paths, before, after, audit_result:, &block) + Utils::Inreplace.inreplace(paths, before, after, audit_result:, global:, &block) rescue Utils::Inreplace::Error => e onoe e.to_s raise BuildError.new(self, "inreplace", Array(paths), {})