mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Port Homebrew::Cmd::Autoremove
This commit is contained in:
parent
c50fb2dbd2
commit
a8f8c65d93
@ -1,27 +1,26 @@
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "abstract_command"
|
||||
require "cleanup"
|
||||
require "cli/parser"
|
||||
|
||||
module Homebrew
|
||||
sig { returns(CLI::Parser) }
|
||||
def self.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."
|
||||
module Cmd
|
||||
class Autoremove < AbstractCommand
|
||||
cmd_args 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
|
||||
named_args :none
|
||||
end
|
||||
|
||||
sig { override.void }
|
||||
def run
|
||||
Cleanup.autoremove(dry_run: args.dry_run?)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
sig { void }
|
||||
def self.autoremove
|
||||
args = autoremove_args.parse
|
||||
|
||||
Cleanup.autoremove(dry_run: args.dry_run?)
|
||||
end
|
||||
end
|
||||
|
@ -1,8 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cmd/autoremove"
|
||||
require "cmd/shared_examples/args_parse"
|
||||
|
||||
RSpec.describe "brew autoremove" do
|
||||
RSpec.describe Homebrew::Cmd::Autoremove do
|
||||
it_behaves_like "parseable arguments"
|
||||
|
||||
describe "integration test" do
|
||||
|
Loading…
x
Reference in New Issue
Block a user