mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Port Homebrew::Cmd::Unlink
This commit is contained in:
parent
4cf9ef831a
commit
5ccb0b0567
@ -1,15 +1,13 @@
|
||||
# typed: true
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cli/parser"
|
||||
require "abstract_command"
|
||||
require "unlink"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
sig { returns(CLI::Parser) }
|
||||
def unlink_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
module Cmd
|
||||
class UnlinkCmd < AbstractCommand
|
||||
cmd_args do
|
||||
description <<~EOS
|
||||
Remove symlinks for <formula> from Homebrew's prefix. This can be useful
|
||||
for temporarily disabling a formula:
|
||||
@ -21,11 +19,9 @@ module Homebrew
|
||||
|
||||
named_args :installed_formula, min: 1
|
||||
end
|
||||
end
|
||||
|
||||
def unlink
|
||||
args = unlink_args.parse
|
||||
|
||||
sig { override.void }
|
||||
def run
|
||||
options = { dry_run: args.dry_run?, verbose: args.verbose? }
|
||||
|
||||
args.named.to_default_kegs.each do |keg|
|
||||
@ -39,3 +35,5 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,8 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cmd/shared_examples/args_parse"
|
||||
require "cmd/unlink"
|
||||
|
||||
RSpec.describe "brew unlink" do
|
||||
RSpec.describe Homebrew::Cmd::UnlinkCmd do
|
||||
it_behaves_like "parseable arguments"
|
||||
|
||||
it "unlinks a Formula", :integration_test do
|
||||
|
Loading…
x
Reference in New Issue
Block a user