Enable typing in Cask::Cmd
This commit is contained in:
parent
6611a03cc6
commit
0c533f27ba
@ -1,4 +1,4 @@
|
||||
# typed: false
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "utils/github/actions"
|
||||
@ -13,6 +13,7 @@ module Cask
|
||||
|
||||
def self.parser
|
||||
super do
|
||||
T.bind(self, Homebrew::CLI::Parser)
|
||||
switch "--[no-]download",
|
||||
description: "Audit the downloaded file"
|
||||
switch "--[no-]appcast",
|
||||
@ -44,7 +45,7 @@ module Cask
|
||||
end
|
||||
casks = casks.map { |c| CaskLoader.load(c, config: Config.from_args(args)) }
|
||||
any_named_args = casks.any?
|
||||
casks = Cask.to_a if casks.empty?
|
||||
casks = Cask.all if casks.empty?
|
||||
|
||||
results = self.class.audit_casks(
|
||||
*casks,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# typed: false
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Cask
|
||||
@ -11,6 +11,7 @@ module Cask
|
||||
|
||||
def self.parser
|
||||
super do
|
||||
T.bind(self, Homebrew::CLI::Parser)
|
||||
switch "--force",
|
||||
description: "Force redownloading even if files already exist in local cache."
|
||||
end
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# typed: false
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cask_dependent"
|
||||
@ -27,6 +27,7 @@ module Cask
|
||||
|
||||
def self.parser(&block)
|
||||
super do
|
||||
T.bind(self, Homebrew::CLI::Parser)
|
||||
switch "--force",
|
||||
description: "Force overwriting existing files."
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# typed: false
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Cask
|
||||
@ -11,6 +11,7 @@ module Cask
|
||||
|
||||
def self.parser
|
||||
super do
|
||||
T.bind(self, Homebrew::CLI::Parser)
|
||||
switch "--force",
|
||||
description: "Uninstall even if the <cask> is not installed, overwrite " \
|
||||
"existing files and ignore errors when removing files."
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# typed: false
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "env_config"
|
||||
@ -30,6 +30,7 @@ module Cask
|
||||
sig { returns(Homebrew::CLI::Parser) }
|
||||
def self.parser
|
||||
super do
|
||||
T.bind(self, Homebrew::CLI::Parser)
|
||||
switch "--force",
|
||||
description: "Force overwriting existing files."
|
||||
switch "--dry-run",
|
||||
@ -176,7 +177,9 @@ module Cask
|
||||
|
||||
return true if caught_exceptions.empty?
|
||||
raise MultipleCaskErrors, caught_exceptions if caught_exceptions.count > 1
|
||||
raise caught_exceptions.first if caught_exceptions.count == 1
|
||||
raise caught_exceptions.fetch(0) if caught_exceptions.count == 1
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
def self.upgrade_cask(
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# typed: false
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Cask
|
||||
@ -11,6 +11,7 @@ module Cask
|
||||
|
||||
def self.parser
|
||||
super do
|
||||
T.bind(self, Homebrew::CLI::Parser)
|
||||
switch "--force",
|
||||
description: "Ignore errors when removing files."
|
||||
end
|
||||
|
||||
@ -10,7 +10,7 @@ describe Cask::Cmd::Audit, :cask do
|
||||
|
||||
describe "selection of Casks to audit" do
|
||||
it "audits all Casks if no tokens are given" do
|
||||
allow(Cask::Cask).to receive(:to_a).and_return([cask, cask])
|
||||
allow(Cask::Cask).to receive(:all).and_return([cask, cask])
|
||||
|
||||
expect(Cask::Auditor).to receive(:audit).twice.and_return(result)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user