# frozen_string_literal: true module Cask class Cmd class Zap < AbstractCommand def self.min_named :cask end def self.description <<~EOS Zaps all files associated with the given . Implicitly also performs all actions associated with `uninstall`. *May remove files which are shared between applications.* EOS end def self.parser super do switch "--force", description: "Ignore errors when removing files." end end def run require "cask/installer" casks.each do |cask| odebug "Zapping Cask #{cask}" if cask.installed? if installed_caskfile = cask.installed_caskfile # Use the same cask file that was used for installation, if possible. cask = CaskLoader.load(installed_caskfile) if installed_caskfile.exist? end else raise CaskNotInstalledError, cask unless args.force? end Installer.new(cask, verbose: args.verbose?, force: args.force?).zap end end end end end