diff --git a/Library/Homebrew/cask/cmd/abstract_command.rb b/Library/Homebrew/cask/cmd/abstract_command.rb index 96cdac5bc9..23e972087c 100644 --- a/Library/Homebrew/cask/cmd/abstract_command.rb +++ b/Library/Homebrew/cask/cmd/abstract_command.rb @@ -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 diff --git a/Library/Homebrew/cask/cmd/audit.rb b/Library/Homebrew/cask/cmd/audit.rb index 80fadd1fe9..6326446fcf 100644 --- a/Library/Homebrew/cask/cmd/audit.rb +++ b/Library/Homebrew/cask/cmd/audit.rb @@ -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, diff --git a/Library/Homebrew/cask/cmd/fetch.rb b/Library/Homebrew/cask/cmd/fetch.rb index 784cd06f8e..da0eb66295 100644 --- a/Library/Homebrew/cask/cmd/fetch.rb +++ b/Library/Homebrew/cask/cmd/fetch.rb @@ -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 diff --git a/Library/Homebrew/cask/cmd/install.rb b/Library/Homebrew/cask/cmd/install.rb index 11cf1f9a1d..efd84d9365 100644 --- a/Library/Homebrew/cask/cmd/install.rb +++ b/Library/Homebrew/cask/cmd/install.rb @@ -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." diff --git a/Library/Homebrew/cask/cmd/uninstall.rb b/Library/Homebrew/cask/cmd/uninstall.rb index 67be493145..1700482a65 100644 --- a/Library/Homebrew/cask/cmd/uninstall.rb +++ b/Library/Homebrew/cask/cmd/uninstall.rb @@ -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 is not installed, overwrite " \ "existing files and ignore errors when removing files." diff --git a/Library/Homebrew/cask/cmd/upgrade.rb b/Library/Homebrew/cask/cmd/upgrade.rb index 134563702a..15dd0d6f08 100644 --- a/Library/Homebrew/cask/cmd/upgrade.rb +++ b/Library/Homebrew/cask/cmd/upgrade.rb @@ -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( diff --git a/Library/Homebrew/cask/cmd/zap.rb b/Library/Homebrew/cask/cmd/zap.rb index 31460340b2..b06bfa4223 100644 --- a/Library/Homebrew/cask/cmd/zap.rb +++ b/Library/Homebrew/cask/cmd/zap.rb @@ -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