32 lines
686 B
Ruby
Raw Normal View History

2016-09-24 13:52:43 +02:00
module Hbc
class CLI
class Home < Base
2017-05-19 21:48:21 +02:00
def self.run(*args)
new(*args).run
end
def run
casks = @args.map(&CaskLoader.public_method(:load))
if casks.empty?
2016-09-24 13:52:43 +02:00
odebug "Opening project homepage"
2017-05-19 21:48:21 +02:00
self.class.open_url "https://caskroom.github.io/"
2016-09-24 13:52:43 +02:00
else
2017-05-19 21:48:21 +02:00
casks.each do |cask|
odebug "Opening homepage for Cask #{cask}"
self.class.open_url cask.homepage
2016-09-24 13:52:43 +02:00
end
end
2016-08-18 22:11:42 +03:00
end
2017-05-19 21:48:21 +02:00
def self.open_url(url)
SystemCommand.run!(OS::PATH_OPEN, args: ["--", url])
end
2016-09-24 13:52:43 +02:00
def self.help
"opens the homepage of the given Cask"
end
end
2016-08-18 22:11:42 +03:00
end
end