Merge pull request #8878 from reitermarkus/upgrade-casks

Force `brew upgrade` to treat arguments as casks if `--cask` is passed.
This commit is contained in:
Markus Reiter 2020-10-08 14:18:46 +02:00 committed by GitHub
commit f84b9a0275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

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

View File

@ -91,7 +91,10 @@ module Homebrew
def upgrade
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
# specified, we want to make note of that so we don't
# try to upgrade all outdated casks.