Class: Homebrew::Cmd::UninstallCmd Private
- Inherits:
-
AbstractCommand
- Object
- AbstractCommand
- Homebrew::Cmd::UninstallCmd
- Defined in:
- cmd/uninstall.rb,
sorbet/rbi/dsl/homebrew/cmd/uninstall_cmd.rbi
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Defined Under Namespace
Classes: Args
Instance Method Summary collapse
- #args ⇒ Homebrew::Cmd::UninstallCmd::Args private
- #run ⇒ void private
Methods inherited from AbstractCommand
command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?
Methods included from Utils::Output::Mixin
#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled
Constructor Details
This class inherits a constructor from Homebrew::AbstractCommand
Instance Method Details
#args ⇒ Homebrew::Cmd::UninstallCmd::Args
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
10 |
# File 'sorbet/rbi/dsl/homebrew/cmd/uninstall_cmd.rbi', line 10 def args; end |
#run ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'cmd/uninstall.rb', line 43 def run method = args.force? ? :kegs : :default_kegs results = args.named.to_formulae_and_casks_and_unavailable(method:) unavailable_errors = T.let([], T::Array[T.any(FormulaOrCaskUnavailableError, NoSuchKegError)]) all_kegs = T.let([], T::Array[Keg]) casks = T.let([], T::Array[Cask::Cask]) results.each do |item| case item when FormulaOrCaskUnavailableError, NoSuchKegError unavailable_errors << item when Cask::Cask casks << item when Keg all_kegs << item when Array all_kegs += item end end return if all_kegs.blank? && casks.blank? && unavailable_errors.blank? kegs_by_rack = all_kegs.group_by(&:rack) Uninstall.uninstall_kegs( kegs_by_rack, casks:, force: args.force?, ignore_dependencies: args.ignore_dependencies?, named_args: args.named, ) Cask::Uninstall.check_dependent_casks(*casks, named_args: args.named) unless args.ignore_dependencies? return if Homebrew.failed? begin if args.zap? caught_exceptions = [] casks.each do |cask| odebug "Zapping Cask #{cask}" raise Cask::CaskNotInstalledError, cask if !cask.installed? && !args.force? Cask::Installer.new(cask, verbose: args.verbose?, force: args.force?).zap rescue => e caught_exceptions << e next end if caught_exceptions.count > 1 raise Cask::MultipleCaskErrors, caught_exceptions elsif caught_exceptions.one? raise caught_exceptions.fetch(0) end else Cask::Uninstall.uninstall_casks( *casks, verbose: args.verbose?, force: args.force?, ) end rescue => e ofail e end if ENV["HOMEBREW_AUTOREMOVE"].present? opoo "`$HOMEBREW_AUTOREMOVE` is now a no-op as it is the default behaviour. " \ "Set `HOMEBREW_NO_AUTOREMOVE=1` to disable it." end Cleanup.autoremove unless Homebrew::EnvConfig.no_autoremove? unavailable_errors.each { |e| ofail e } unless args.force? end |