brew/Library/Homebrew/cmd/autoremove.rb
apainintheneck fe83500617 Moved autoremove logic into cleanup.rb and formula.rb
Cleanup.rb:
- Added #autoremove method
- #autoremove is called in clean when HOMEBREW_AUTOREMOVE is set

Formula.rb:
- Added #unused_formulae_with_no_dependents and helpers

Removed old autoremove.rb module.
2022-07-14 13:16:26 -07:00

28 lines
606 B
Ruby

# typed: true
# frozen_string_literal: true
require "cleanup"
require "cli/parser"
module Homebrew
module_function
def autoremove_args
Homebrew::CLI::Parser.new do
description <<~EOS
Uninstall formulae that were only installed as a dependency of another formula and are now no longer needed.
EOS
switch "-n", "--dry-run",
description: "List what would be uninstalled, but do not actually uninstall anything."
named_args :none
end
end
def autoremove
args = autoremove_args.parse
Cleanup.autoremove(dry_run: args.dry_run?)
end
end