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
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "abstract_command"
|
||||||
require "cleanup"
|
require "cleanup"
|
||||||
require "cli/parser"
|
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
sig { returns(CLI::Parser) }
|
module Cmd
|
||||||
def self.autoremove_args
|
class Autoremove < AbstractCommand
|
||||||
Homebrew::CLI::Parser.new do
|
cmd_args do
|
||||||
description <<~EOS
|
description <<~EOS
|
||||||
Uninstall formulae that were only installed as a dependency of another formula and are now no longer needed.
|
Uninstall formulae that were only installed as a dependency of another formula and are now no longer needed.
|
||||||
EOS
|
EOS
|
||||||
@ -16,12 +16,11 @@ module Homebrew
|
|||||||
|
|
||||||
named_args :none
|
named_args :none
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
sig { void }
|
|
||||||
def self.autoremove
|
|
||||||
args = autoremove_args.parse
|
|
||||||
|
|
||||||
|
sig { override.void }
|
||||||
|
def run
|
||||||
Cleanup.autoremove(dry_run: args.dry_run?)
|
Cleanup.autoremove(dry_run: args.dry_run?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "cmd/autoremove"
|
||||||
require "cmd/shared_examples/args_parse"
|
require "cmd/shared_examples/args_parse"
|
||||||
|
|
||||||
RSpec.describe "brew autoremove" do
|
RSpec.describe Homebrew::Cmd::Autoremove do
|
||||||
it_behaves_like "parseable arguments"
|
it_behaves_like "parseable arguments"
|
||||||
|
|
||||||
describe "integration test" do
|
describe "integration test" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user