outdated: Fix most code review comments
This commit is contained in:
parent
fa0f6f4d5b
commit
8d4a443e4d
@ -46,7 +46,7 @@ module Homebrew
|
||||
|
||||
case json_version
|
||||
when :v1
|
||||
opoo "JSON v1 has been deprecated; please use --json=v2"
|
||||
odeprecated "brew outdated --json=v1", "brew outdated --json=v2"
|
||||
|
||||
outdated = if args.formula? || !args.cask?
|
||||
outdated_formulae
|
||||
@ -87,9 +87,8 @@ module Homebrew
|
||||
Homebrew.failed = args.named.present? && outdated.present?
|
||||
end
|
||||
|
||||
def print_outdated(formula_or_cask)
|
||||
return formula_or_cask.each { |f_or_c| print_outdated(f_or_c) } if formula_or_cask.is_a? Array
|
||||
|
||||
def print_outdated(formulae_or_casks)
|
||||
formulae_or_casks.each do |formula_or_cask|
|
||||
if formula_or_cask.is_a?(Formula)
|
||||
f = formula_or_cask
|
||||
|
||||
@ -125,10 +124,10 @@ module Homebrew
|
||||
puts c.outdated_info(args.greedy?, verbose?, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def json_info(formula_or_cask)
|
||||
return formula_or_cask.map { |f_or_c| json_info(f_or_c) } if formula_or_cask.is_a? Array
|
||||
|
||||
def json_info(formulae_or_casks)
|
||||
formulae_or_casks.map do |formula_or_cask|
|
||||
if formula_or_cask.is_a?(Formula)
|
||||
f = formula_or_cask
|
||||
|
||||
@ -150,6 +149,7 @@ module Homebrew
|
||||
c.outdated_info(args.greedy?, verbose?, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def verbose?
|
||||
($stdout.tty? || args.verbose?) && !args.quiet?
|
||||
@ -173,9 +173,11 @@ module Homebrew
|
||||
end
|
||||
|
||||
def outdated_casks
|
||||
select_outdated(
|
||||
args.named.present? ? args.named.uniq.map { |ref| Cask::CaskLoader.load ref } : Cask::Caskroom.casks,
|
||||
)
|
||||
if args.named.present?
|
||||
select_outdated(args.named.uniq.map(&Cask::CaskLoader.method(:load)))
|
||||
else
|
||||
select_outdated(Cask::Caskroom.casks)
|
||||
end
|
||||
end
|
||||
|
||||
def outdated_formulae_casks
|
||||
@ -190,8 +192,12 @@ module Homebrew
|
||||
end
|
||||
|
||||
def select_outdated(formulae_or_casks)
|
||||
formulae_or_casks.select do |fc|
|
||||
fc.is_a?(Formula) ? fc.outdated?(fetch_head: args.fetch_HEAD?) : fc.outdated?(args.greedy?)
|
||||
formulae_or_casks.select do |formula_or_cask|
|
||||
if formula_or_cask.is_a?(Formula)
|
||||
formula_or_cask.outdated?(fetch_head: args.fetch_HEAD?)
|
||||
else
|
||||
formula_or_cask.outdated?(args.greedy?)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user