Class: Cask::Cmd::Home

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

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCommand

abstract?, command_name, #initialize, run, visible

Methods included from Homebrew::Search

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

Methods included from Options

#process_arguments

Constructor Details

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

Class Method Details

.helpObject



22
23
24
# File 'brew/Library/Homebrew/cask/cmd/home.rb', line 22

def self.help
  "opens the homepage of the given Cask"
end

.open_url(url) ⇒ Object



18
19
20
# File 'brew/Library/Homebrew/cask/cmd/home.rb', line 18

def self.open_url(url)
  SystemCommand.run!(OS::PATH_OPEN, args: ["--", url])
end

Instance Method Details

#runObject



6
7
8
9
10
11
12
13
14
15
16
# File 'brew/Library/Homebrew/cask/cmd/home.rb', line 6

def run
  if casks.none?
    odebug "Opening project homepage"
    self.class.open_url "https://brew.sh/"
  else
    casks.each do |cask|
      odebug "Opening homepage for Cask #{cask}"
      self.class.open_url cask.homepage
    end
  end
end