Merge pull request #20356 from Homebrew/kernel-sigs

extend/kernel: tighten up some type signatures
This commit is contained in:
Carlo Cabrera 2025-08-01 18:32:48 +00:00 committed by GitHub
commit f2c32156e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -234,36 +234,36 @@ module Kernel
odeprecated(method, replacement, disable: true, disable_on:, disable_for_developers:, caller:)
end
sig { params(formula: T.any(String, Formula)).returns(String) }
def pretty_installed(formula)
sig { params(string: String).returns(String) }
def pretty_installed(string)
if !$stdout.tty?
formula.to_s
string
elsif Homebrew::EnvConfig.no_emoji?
Formatter.success("#{Tty.bold}#{formula} (installed)#{Tty.reset}")
Formatter.success("#{Tty.bold}#{string} (installed)#{Tty.reset}")
else
"#{Tty.bold}#{formula} #{Formatter.success("")}#{Tty.reset}"
"#{Tty.bold}#{string} #{Formatter.success("")}#{Tty.reset}"
end
end
sig { params(formula: T.any(String, Formula)).returns(String) }
def pretty_outdated(formula)
sig { params(string: String).returns(String) }
def pretty_outdated(string)
if !$stdout.tty?
formula.to_s
string
elsif Homebrew::EnvConfig.no_emoji?
Formatter.error("#{Tty.bold}#{formula} (outdated)#{Tty.reset}")
Formatter.error("#{Tty.bold}#{string} (outdated)#{Tty.reset}")
else
"#{Tty.bold}#{formula} #{Formatter.warning("")}#{Tty.reset}"
"#{Tty.bold}#{string} #{Formatter.warning("")}#{Tty.reset}"
end
end
sig { params(formula: T.any(String, Formula)).returns(String) }
def pretty_uninstalled(formula)
sig { params(string: String).returns(String) }
def pretty_uninstalled(string)
if !$stdout.tty?
formula.to_s
string
elsif Homebrew::EnvConfig.no_emoji?
Formatter.error("#{Tty.bold}#{formula} (uninstalled)#{Tty.reset}")
Formatter.error("#{Tty.bold}#{string} (uninstalled)#{Tty.reset}")
else
"#{Tty.bold}#{formula} #{Formatter.error("")}#{Tty.reset}"
"#{Tty.bold}#{string} #{Formatter.error("")}#{Tty.reset}"
end
end