brew/Library/Homebrew/cask/cmd/outdated.rb

31 lines
770 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2018-09-06 08:29:14 +02:00
module Cask
2018-09-04 08:45:48 +01:00
class Cmd
2017-05-20 19:08:03 +02:00
class Outdated < AbstractCommand
2017-05-21 00:15:56 +02:00
option "--greedy", :greedy, false
option "--quiet", :quiet, false
option "--json", :json, false
2017-05-20 03:38:51 +02:00
2017-05-21 00:15:56 +02:00
def initialize(*)
super
self.verbose = ($stdout.tty? || verbose?) && !quiet?
@outdated_casks = casks(alternative: -> { Caskroom.casks }).select do |cask|
2017-02-27 22:33:34 +02:00
odebug "Checking update info of Cask #{cask}"
cask.outdated?(greedy?)
2017-02-27 22:33:34 +02:00
end
end
def run
output = @outdated_casks.map { |cask| cask.outdated_info(greedy?, verbose?, json?) }
2017-02-27 22:33:34 +02:00
puts json? ? JSON.generate(output) : output
2017-02-27 22:33:34 +02:00
end
def self.help
"list the outdated installed Casks"
end
end
end
end