2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
module Cask
|
2018-09-04 08:45:48 +01:00
|
|
|
class Cmd
|
2017-05-20 19:08:03 +02:00
|
|
|
class Home < AbstractCommand
|
2020-08-01 02:30:46 +02:00
|
|
|
def self.description
|
|
|
|
"Opens the homepage of the given <cask>. If no cask is given, opens the Homebrew homepage."
|
|
|
|
end
|
|
|
|
|
2017-05-19 21:48:21 +02:00
|
|
|
def run
|
2017-06-13 17:14:01 +02:00
|
|
|
if casks.none?
|
2016-09-24 13:52:43 +02:00
|
|
|
odebug "Opening project homepage"
|
2019-04-13 19:40:35 +01:00
|
|
|
self.class.open_url "https://brew.sh/"
|
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
|
|
|
end
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
end
|