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,13 +1,13 @@
|
||||
# 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
|
||||
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
|
||||
@ -16,12 +16,11 @@ module Homebrew
|
||||
|
||||
named_args :none
|
||||
end
|
||||
end
|
||||
|
||||
sig { void }
|
||||
def self.autoremove
|
||||
args = autoremove_args.parse
|
||||
|
||||
sig { override.void }
|
||||
def run
|
||||
Cleanup.autoremove(dry_run: args.dry_run?)
|
||||
end
|
||||
end
|
||||
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