aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/cli/install.rb
blob: 9a2116e6ac9c9e715d33c99f89991a5cc449b04a (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
25
26
27
28
29
30
31
32
33
34
35
module Hbc
  class CLI
    class Install < AbstractCommand
      option "--force",          :force,          false
      option "--skip-cask-deps", :skip_cask_deps, false

      def initialize(*)
        super
        raise CaskUnspecifiedError if args.empty?
      end

      def run
        casks.each do |cask|
          begin
            Installer.new(cask, binaries:       binaries?,
                                verbose:        verbose?,
                                force:          force?,
                                skip_cask_deps: skip_cask_deps?,
                                require_sha:    require_sha?).install
          rescue CaskAlreadyInstalledError => e
            opoo e.message
          end
        end
      end

      def self.help
        "installs the given Cask"
      end

      def self.needs_init?
        true
      end
    end
  end
end