cli/named_args: silence package_conflicts_message with --quiet

Based on feedback from Homebrew/discussions#5602.

While users can already silence this by passing `--formula` or `--cask`
as required, I am inclined to agree that `--quiet` should probably
silence messages that are relatively low priority (of which I think this
is one).
This commit is contained in:
Carlo Cabrera 2024-09-15 18:51:06 +08:00
parent 1f306b4d15
commit 150e14f83d
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -231,11 +231,13 @@ module Homebrew
Failed to load cask: #{name} Failed to load cask: #{name}
#{unreadable_error} #{unreadable_error}
EOS EOS
opoo package_conflicts_message(name, "formula", cask) opoo package_conflicts_message(name, "formula", cask) unless Context.current.quiet?
end end
return formula_or_kegs return formula_or_kegs
elsif cask elsif cask
opoo package_conflicts_message(name, "cask", formula_or_kegs) if formula_or_kegs if formula_or_kegs && !Context.current.quiet?
opoo package_conflicts_message(name, "cask", formula_or_kegs)
end
return cask return cask
end end
end end
@ -519,6 +521,7 @@ module Homebrew
nil nil
end end
return unless available return unless available
return if Context.current.quiet?
opoo package_conflicts_message(ref, loaded_type, cask) opoo package_conflicts_message(ref, loaded_type, cask)
end end