homebrew-cask-versions/lib/cask/cli/edit.rb
Roland Walker 36cd9e4d72 accept and ignore trailing .rb on CL arguments
"Be conservative in what you do, be liberal in what you accept."
2014-02-25 18:24:58 -05:00

16 lines
491 B
Ruby

module Cask::CLI::Edit
def self.run(*arguments)
raise CaskUnspecifiedError if arguments.empty?
cask_name = arguments.first.sub(/\.rb$/i,'')
cask_path = Cask.path(cask_name)
odebug "Opening editor for Cask #{cask_name}"
unless cask_path.exist?
raise CaskUnavailableError, "#{cask_name}, use `brew cask create #{cask_name}` to make a new cask with this name"
end
exec_editor cask_path
end
def self.help
"edits the cask of the given name"
end
end