Force brew upgrade to treat arguments as casks if --cask is passed.

This commit is contained in:
Markus Reiter 2020-10-08 13:43:15 +02:00
parent c9e2a06ff5
commit e117a68f42
2 changed files with 6 additions and 3 deletions

View File

@ -79,8 +79,8 @@ module Homebrew
.freeze .freeze
end end
def to_resolved_formulae_to_casks def to_resolved_formulae_to_casks(only: nil)
@to_resolved_formulae_to_casks ||= to_formulae_and_casks(method: :resolve) @to_resolved_formulae_to_casks ||= to_formulae_and_casks(method: :resolve, only: only)
.partition { |o| o.is_a?(Formula) } .partition { |o| o.is_a?(Formula) }
.map(&:freeze).freeze .map(&:freeze).freeze
end end

View File

@ -91,7 +91,10 @@ module Homebrew
def upgrade def upgrade
args = upgrade_args.parse args = upgrade_args.parse
formulae, casks = args.named.to_resolved_formulae_to_casks only = :formula if args.formula? && !args.cask?
only = :cask if args.cask? && !args.formula?
formulae, casks = args.named.to_resolved_formulae_to_casks(only: only)
# If one or more formulae are specified, but no casks were # If one or more formulae are specified, but no casks were
# specified, we want to make note of that so we don't # specified, we want to make note of that so we don't
# try to upgrade all outdated casks. # try to upgrade all outdated casks.