Class: Cask::Uninstall Private

Inherits:
Object
  • Object
show all
Defined in:
cask/uninstall.rb

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Class Method Summary collapse

Class Method Details

.uninstall_casks(*casks, binaries: nil, force: false, verbose: false) ⇒ Object

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'cask/uninstall.rb', line 7

def self.uninstall_casks(*casks, binaries: nil, force: false, verbose: false)
  require "cask/installer"

  casks.each do |cask|
    odebug "Uninstalling Cask #{cask}"

    raise CaskNotInstalledError, cask if !cask.installed? && !force

    Installer.new(cask, binaries: binaries, force: force, verbose: verbose).uninstall

    next if (versions = cask.versions).empty?

    puts <<~EOS
      #{cask} #{versions.to_sentence} #{(versions.count == 1) ? "is" : "are"} still installed.
      Remove #{(versions.count == 1) ? "it" : "them all"} with `brew uninstall --cask --force #{cask}`.
    EOS
  end
end