Fix PR issues

This commit is contained in:
William Ma 2020-07-09 08:55:42 -04:00 committed by Jonathan Chang
parent d81296f8dc
commit 299db98dbf
2 changed files with 11 additions and 9 deletions

View File

@ -26,7 +26,7 @@ module Homebrew
"value for <version> is `v1`. See the docs for examples of using the JSON "\ "value for <version> is `v1`. See the docs for examples of using the JSON "\
"output: <https://docs.brew.sh/Querying-Brew>. "\ "output: <https://docs.brew.sh/Querying-Brew>. "\
"By default, this option treats all arguments as formulae. "\ "By default, this option treats all arguments as formulae. "\
"To treat arguments as casks, use the --cask-only option." "To treat arguments as casks, use the --cask option."
switch "--fetch-HEAD", switch "--fetch-HEAD",
description: "Fetch the upstream repository to detect if the HEAD installation of the "\ description: "Fetch the upstream repository to detect if the HEAD installation of the "\
"formula is outdated. Otherwise, the repository's HEAD will only be checked for "\ "formula is outdated. Otherwise, the repository's HEAD will only be checked for "\
@ -39,7 +39,7 @@ module Homebrew
description: "Treat all arguments as casks" description: "Treat all arguments as casks"
switch :debug switch :debug
conflicts "--quiet", "--verbose", "--json" conflicts "--quiet", "--verbose", "--json"
conflicts "--formula-only", "--cask-only" conflicts "--formula", "--cask"
end end
end end
@ -54,12 +54,14 @@ module Homebrew
formula_only = !args.cask? formula_only = !args.cask?
end end
if formula_only outdated = if formula_only
formulae = args.resolved_formulae.blank? ? Formula.installed : args.resolved_formulae formulae = args.resolved_formulae.presence || Formula.installed
outdated = print_outdated_formulae(formulae)
print_outdated_formulae(formulae)
elsif args.cask? elsif args.cask?
casks = args.named.blank? ? Cask::Caskroom.casks : args.named casks = args.named.presence || Cask::Caskroom.casks.presence
outdated = print_outdated_casks(casks)
print_outdated_casks(casks)
else else
formulae, casks = args.resolved_formulae_casks formulae, casks = args.resolved_formulae_casks
@ -68,7 +70,7 @@ module Homebrew
casks = Cask::Caskroom.casks casks = Cask::Caskroom.casks
end end
outdated = print_outdated_formulae(formulae) + print_outdated_casks(casks) print_outdated_formulae(formulae) + print_outdated_casks(casks)
end end
Homebrew.failed = args.named.present? && outdated.present? Homebrew.failed = args.named.present? && outdated.present?

View File

@ -94,7 +94,7 @@ module Homebrew
end end
end end
return if outdated.empty? return if outdated.blank?
pinned = outdated.select(&:pinned?) pinned = outdated.select(&:pinned?)
outdated -= pinned outdated -= pinned