From 8b4197dd10203c22f3ef2b4f334b208c15eff7ac Mon Sep 17 00:00:00 2001 From: Tie Date: Fri, 6 Nov 2020 10:36:21 -0500 Subject: [PATCH] make suggestions round 2 --- Library/Homebrew/cmd/autoremove.rb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/cmd/autoremove.rb b/Library/Homebrew/cmd/autoremove.rb index 771fdad0f0..fd5c786f5b 100644 --- a/Library/Homebrew/cmd/autoremove.rb +++ b/Library/Homebrew/cmd/autoremove.rb @@ -13,10 +13,10 @@ module Homebrew usage_banner <<~EOS `autoremove` [] - Remove packages that weren't installed on request and are no longer needed. + Uninstall formulae that were only installed as a dependency of another formula and are now no longer needed. EOS switch "-n", "--dry-run", - description: "Just print what would be removed." + description: "List what would be uninstalled, but do not actually uninstall anything." named 0 end end @@ -26,7 +26,7 @@ module Homebrew Tab.for_keg(f.any_installed_keg).installed_on_request end - removable_formulae += get_removable_formulae(formulae - removable_formulae) if removable_formulae.any? + removable_formulae += get_removable_formulae(formulae - removable_formulae) if removable_formulae.present? removable_formulae end @@ -35,18 +35,15 @@ module Homebrew args = autoremove_args.parse removable_formulae = get_removable_formulae(Formula.installed) - return if removable_formulae.blank? formulae_names = removable_formulae.map(&:full_name).sort - intent = args.dry_run? ? "could" : "will" - oh1 "Formulae that #{intent} be removed" - puts formulae_names - + verb = args.dry_run? ? "Would uninstall" : "Uninstalling" + oh1 "#{verb} #{formulae_names.count} unneeded #{"formula".pluralize(formulae_names.count)}:" + puts formulae_names.join("\n") return if args.dry_run? - puts kegs_by_rack = removable_formulae.map(&:any_installed_keg).group_by(&:rack) Uninstall.uninstall_kegs(kegs_by_rack) end