23 lines
666 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 Edit < AbstractCommand
2017-05-19 22:01:50 +02:00
def run
cask_tokens = self.class.cask_tokens_from(@args)
2016-09-24 13:52:43 +02:00
raise CaskUnspecifiedError if cask_tokens.empty?
# only respects the first argument
cask_token = cask_tokens.first.sub(/\.rb$/i, "")
cask_path = CaskLoader.path(cask_token)
2016-09-24 13:52:43 +02:00
odebug "Opening editor for Cask #{cask_token}"
unless cask_path.exist?
raise CaskUnavailableError, %Q(#{cask_token}, run "brew cask create #{cask_token}" to create a new Cask)
2016-09-24 13:52:43 +02:00
end
exec_editor cask_path
end
2016-08-18 22:11:42 +03:00
2016-09-24 13:52:43 +02:00
def self.help
"edits the given Cask"
end
end
2016-08-18 22:11:42 +03:00
end
end