Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Library/Homebrew/cask/lib/hbc/cli/edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ def initialize(*)
end

def run
cask = casks.first
cask_path = cask.sourcefile_path
odebug "Opening editor for Cask #{cask.token}"
exec_editor cask_path
rescue CaskUnavailableError => e
reason = e.reason.empty? ? "" : "#{e.reason} "
reason.concat("Run #{Formatter.identifier("brew cask create #{e.token}")} to create a new Cask.")
raise e.class.new(e.token, reason)
end

def cask_path
casks.first.sourcefile_path
rescue CaskInvalidError
path = CaskLoader.path(args.first)
return path if path.file?
raise
end

def self.help
"edits the given Cask"
end
Expand Down