28 lines
636 B
Ruby
Raw Normal View History

2016-09-24 13:52:43 +02:00
module Hbc
class CLI
2017-05-20 19:08:03 +02:00
class Home < AbstractCommand
2017-05-19 21:48:21 +02:00
def run
2017-05-21 00:15:56 +02:00
casks = args.map(&CaskLoader.public_method(:load))
2017-05-19 21:48:21 +02:00
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