aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/cli/cat.rb
blob: d08c87bea2fa8e9cfcda1c43297354ac3a114351 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module Hbc
  class CLI
    class Cat < AbstractCommand
      def initialize(*)
        super
        raise CaskUnspecifiedError if args.empty?
      end

      def run
        raise CaskError, "Cat incomplete." if cat_casks == :incomplete
      end

      def cat_casks
        casks.each do |cask|
          puts File.open(cask.sourcefile_path, &:read)
        end
      end

      def self.help
        "dump raw source of the given Cask to the standard output"
      end
    end
  end
end