Class: Hbc::CLI::Home

Inherits:
AbstractCommand show all
Defined in:
Library/Homebrew/cask/lib/hbc/cli/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, needs_init?, run, visible

Methods included from Options

included, #process_arguments

Constructor Details

This class inherits a constructor from Hbc::CLI::AbstractCommand

Class Method Details

.helpObject



20
21
22
# File 'Library/Homebrew/cask/lib/hbc/cli/home.rb', line 20

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

.open_url(url) ⇒ Object



16
17
18
# File 'Library/Homebrew/cask/lib/hbc/cli/home.rb', line 16

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

Instance Method Details

#runObject



4
5
6
7
8
9
10
11
12
13
14
# File 'Library/Homebrew/cask/lib/hbc/cli/home.rb', line 4

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