42 lines
813 B
Ruby
Raw Normal View History

2020-10-10 14:16:11 +02:00
# typed: true
# frozen_string_literal: true
module Cask
class Cmd
2020-08-19 10:34:07 +02:00
# Implementation of the `brew cask --cache` command.
#
# @api private
class Cache < AbstractCommand
2020-10-20 12:03:48 +02:00
extend T::Sig
sig { override.returns(T.nilable(T.any(Integer, Symbol))) }
2020-08-01 02:30:46 +02:00
def self.min_named
:cask
end
2020-10-20 12:03:48 +02:00
sig { returns(String) }
2020-08-01 02:30:46 +02:00
def self.description
"Display the file used to cache a <cask>."
end
2020-10-20 12:03:48 +02:00
sig { returns(String) }
2020-08-01 02:30:46 +02:00
def self.command_name
"--cache"
end
2020-10-20 12:03:48 +02:00
sig { void }
def run
casks.each do |cask|
puts self.class.cached_location(cask)
end
end
def self.cached_location(cask)
2020-08-18 00:23:23 +01:00
require "cask/download"
Download.new(cask).downloader.cached_location
end
end
end
end