Port Homebrew::Cmd::Untap

This commit is contained in:
Douglas Eichelberger 2024-04-01 11:50:25 -07:00
parent f8caae06f7
commit 48f4adad33
2 changed files with 40 additions and 40 deletions

View File

@ -1,13 +1,13 @@
# typed: strict
# frozen_string_literal: true
require "cli/parser"
require "abstract_command"
require "untap"
module Homebrew
sig { returns(CLI::Parser) }
def self.untap_args
Homebrew::CLI::Parser.new do
module Cmd
class UntapCmd < AbstractCommand
cmd_args do
description <<~EOS
Remove a tapped formula repository.
EOS
@ -16,12 +16,9 @@ module Homebrew
named_args :tap, min: 1
end
end
sig { void }
def self.untap
args = untap_args.parse
sig { override.void }
def run
args.named.to_installed_taps.each do |tap|
odie "Untapping #{tap} is not allowed" if tap.core_tap? && Homebrew::EnvConfig.no_install_from_api?
@ -48,4 +45,6 @@ module Homebrew
tap.uninstall manual: true
end
end
end
end
end

View File

@ -1,8 +1,9 @@
# frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "cmd/untap"
RSpec.describe "brew untap" do
RSpec.describe Homebrew::Cmd::UntapCmd do
it_behaves_like "parseable arguments"
it "untaps a given Tap", :integration_test do