Undo changes to cask/cmd

This commit is contained in:
Douglas Eichelberger 2023-03-02 16:50:12 -08:00
parent 0c533f27ba
commit ccabd3318e
7 changed files with 16 additions and 19 deletions

View File

@ -1,4 +1,4 @@
# typed: true
# typed: false
# frozen_string_literal: true
require "search"
@ -40,12 +40,12 @@ module Cask
sig { returns(String) }
def self.command_name
@command_name ||= T.must(name).sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1_\2').downcase
@command_name ||= name.sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1_\2').downcase
end
sig { returns(T::Boolean) }
def self.abstract?
T.must(name).split("::").fetch(-1).match?(/^Abstract[^a-z]/)
name.split("::").last.match?(/^Abstract[^a-z]/)
end
sig { returns(T::Boolean) }
@ -58,6 +58,11 @@ module Cask
parser.generate_help_text
end
sig { returns(String) }
def self.short_description
description[/\A[^.]*\./]
end
def self.run(*args)
new(*args).run
end

View File

@ -1,4 +1,4 @@
# typed: true
# typed: false
# frozen_string_literal: true
require "utils/github/actions"
@ -13,7 +13,6 @@ module Cask
def self.parser
super do
T.bind(self, Homebrew::CLI::Parser)
switch "--[no-]download",
description: "Audit the downloaded file"
switch "--[no-]appcast",
@ -45,7 +44,7 @@ module Cask
end
casks = casks.map { |c| CaskLoader.load(c, config: Config.from_args(args)) }
any_named_args = casks.any?
casks = Cask.all if casks.empty?
casks = Cask.to_a if casks.empty?
results = self.class.audit_casks(
*casks,

View File

@ -1,4 +1,4 @@
# typed: true
# typed: false
# frozen_string_literal: true
module Cask
@ -11,7 +11,6 @@ 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

View File

@ -1,4 +1,4 @@
# typed: true
# typed: false
# frozen_string_literal: true
require "cask_dependent"
@ -27,7 +27,6 @@ module Cask
def self.parser(&block)
super do
T.bind(self, Homebrew::CLI::Parser)
switch "--force",
description: "Force overwriting existing files."

View File

@ -1,4 +1,4 @@
# typed: true
# typed: false
# frozen_string_literal: true
module Cask
@ -11,7 +11,6 @@ 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."

View File

@ -1,4 +1,4 @@
# typed: true
# typed: false
# frozen_string_literal: true
require "env_config"
@ -30,7 +30,6 @@ 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",
@ -177,9 +176,7 @@ module Cask
return true if caught_exceptions.empty?
raise MultipleCaskErrors, caught_exceptions if caught_exceptions.count > 1
raise caught_exceptions.fetch(0) if caught_exceptions.count == 1
false
raise caught_exceptions.first if caught_exceptions.count == 1
end
def self.upgrade_cask(

View File

@ -1,4 +1,4 @@
# typed: true
# typed: false
# frozen_string_literal: true
module Cask
@ -11,7 +11,6 @@ module Cask
def self.parser
super do
T.bind(self, Homebrew::CLI::Parser)
switch "--force",
description: "Ignore errors when removing files."
end