support `brew cask edit`
This commit is contained in:
parent
029bd855db
commit
b45974c224
|
@ -8,10 +8,12 @@ HOME_APPS = Pathname.new(File.expand_path("~/Applications"))
|
|||
class Cask; end
|
||||
|
||||
require 'cask/cli'
|
||||
require 'cask/cli/edit'
|
||||
require 'cask/cli/install'
|
||||
require 'cask/cli/linkapps'
|
||||
require 'cask/cli/list'
|
||||
require 'cask/cli/search'
|
||||
require 'cask/exceptions'
|
||||
require 'plist/parser'
|
||||
|
||||
class Cask
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
class Cask::CLI::Edit
|
||||
def self.run(*arguments)
|
||||
cask_name, *rest = *arguments
|
||||
cask_path = Cask.path.join("#{cask_name}.rb")
|
||||
raise CaskUnavailableError, cask_path.basename('.rb').to_s unless cask_path.file?
|
||||
exec_editor cask_path
|
||||
end
|
||||
|
||||
def self.help
|
||||
"edits the cask of the given name"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class CaskUnavailableError < RuntimeError
|
||||
attr_reader :name
|
||||
def initialize name
|
||||
@name = name
|
||||
end
|
||||
|
||||
def to_s
|
||||
"No available cask for #{name}"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue