2023-08-08 13:54:59 -07:00
|
|
|
# typed: strict
|
2020-09-10 19:45:02 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-07-14 13:16:26 -07:00
|
|
|
require "cleanup"
|
2020-09-10 19:45:02 +02:00
|
|
|
require "cli/parser"
|
|
|
|
|
|
|
|
module Homebrew
|
2023-08-08 13:54:59 -07:00
|
|
|
sig { returns(CLI::Parser) }
|
|
|
|
def self.autoremove_args
|
2020-09-10 19:45:02 +02:00
|
|
|
Homebrew::CLI::Parser.new do
|
2021-01-15 15:04:02 -05:00
|
|
|
description <<~EOS
|
2020-11-06 10:36:21 -05:00
|
|
|
Uninstall formulae that were only installed as a dependency of another formula and are now no longer needed.
|
2020-09-10 19:45:02 +02:00
|
|
|
EOS
|
|
|
|
switch "-n", "--dry-run",
|
2020-11-06 10:36:21 -05:00
|
|
|
description: "List what would be uninstalled, but do not actually uninstall anything."
|
2020-11-12 10:40:41 -05:00
|
|
|
|
2021-01-10 14:26:40 -05:00
|
|
|
named_args :none
|
2020-09-10 19:45:02 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-08-08 13:54:59 -07:00
|
|
|
sig { void }
|
|
|
|
def self.autoremove
|
2020-09-10 19:45:02 +02:00
|
|
|
args = autoremove_args.parse
|
|
|
|
|
2022-07-14 13:16:26 -07:00
|
|
|
Cleanup.autoremove(dry_run: args.dry_run?)
|
2020-09-10 19:45:02 +02:00
|
|
|
end
|
|
|
|
end
|