Class: Cask::Cmd::Outdated Private

Inherits:
AbstractCommand show all
Defined in:
Library/Homebrew/cask/cmd/outdated.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Implementation of the brew cask outdated command.

Constant Summary

Constants inherited from AbstractCommand

AbstractCommand::OPTIONS

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCommand

abstract?, banner_args, banner_headline, command_name, help, #initialize, max_named, min_named, run, short_description, visible?

Methods included from Homebrew::Search

#query_regexp, #search_casks, #search_descriptions, #search_formulae, #search_taps

Constructor Details

This class inherits a constructor from Cask::Cmd::AbstractCommand

Class Method Details

.descriptionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


10
11
12
# File 'Library/Homebrew/cask/cmd/outdated.rb', line 10

def self.description
  "List the outdated installed casks."
end

.parserObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


14
15
16
17
18
19
20
21
# File 'Library/Homebrew/cask/cmd/outdated.rb', line 14

def self.parser
  super do
    switch "--greedy",
           description: "Also include casks which specify `auto_updates true` or `version :latest`."
    switch "--json",
           description: "Print a JSON representation of outdated casks."
  end
end

Instance Method Details

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


23
24
25
26
27
28
29
30
31
32
33
# File 'Library/Homebrew/cask/cmd/outdated.rb', line 23

def run
  outdated_casks = casks(alternative: -> { Caskroom.casks(config: Config.from_args(args)) }).select do |cask|
    odebug "Checking update info of Cask #{cask}"
    cask.outdated?(greedy: args.greedy?)
  end

  verbose = ($stdout.tty? || args.verbose?) && !args.quiet?
  output = outdated_casks.map { |cask| cask.outdated_info(args.greedy?, verbose, args.json?) }

  puts args.json? ? JSON.generate(output) : output
end