Merge pull request #16043 from MikeMcQuaid/cli_parser_env_external_commands

cli/parser: check env var directly if there's no `EnvConfig` method.
This commit is contained in:
Mike McQuaid 2023-09-27 12:50:29 +01:00 committed by GitHub
commit d799bd449c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -185,7 +185,12 @@ module Homebrew
def env?(env)
return if env.blank?
Homebrew::EnvConfig.try(:"#{env}?")
method_name = :"#{env}?"
if Homebrew::EnvConfig.respond_to?(method_name)
Homebrew::EnvConfig.public_send(method_name)
else
ENV.fetch("HOMEBREW_#{env.upcase}", nil)
end
end
def description(text = nil)