cask: add new --cache command

It prints the file used to cache Casks.

This can be used to help users to install casks with their files
downloaded from outside brew.

See #6157.
This commit is contained in:
Cheng XU 2019-05-23 15:20:24 +08:00
parent 2d445aed5f
commit 169ac2d413
No known key found for this signature in database
GPG Key ID: B19F15830AB4E690
2 changed files with 29 additions and 0 deletions

View File

@ -10,6 +10,7 @@ require "cask/config"
require "cask/cmd/options" require "cask/cmd/options"
require "cask/cmd/abstract_command" require "cask/cmd/abstract_command"
require "cask/cmd/--cache"
require "cask/cmd/audit" require "cask/cmd/audit"
require "cask/cmd/automerge" require "cask/cmd/automerge"
require "cask/cmd/cat" require "cask/cmd/cat"

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
require "cask/download"
module Cask
class Cmd
class Cache < AbstractCommand
def self.command_name
"--cache"
end
def initialize(*)
super
raise CaskUnspecifiedError if args.empty?
end
def run
casks.each do |cask|
puts Download.new(cask).downloader.cached_location
end
end
def self.help
"display the file used to cache the Cask"
end
end
end
end