homebrew-cask-versions/lib/cask/cli/cat.rb
Roland Walker b7573b3838 create abstract Cask::CLI::Base
from which all commands inherit.  Add `visible` method
for future use.
2014-06-20 15:06:29 -04:00

14 lines
455 B
Ruby

class Cask::CLI::Cat < Cask::CLI::Base
def self.run(*arguments)
# only respects the first argument
raise CaskUnspecifiedError if arguments.empty?
cask_name = arguments.first.sub(/\.rb$/i, '')
cask_path = Cask.path(cask_name)
raise CaskUnavailableError, cask_name.to_s unless cask_path.exist?
puts File.open(cask_path) { |f| f.read }
end
def self.help
"dump raw source of the given Cask to the standard output"
end
end