mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Port Homebrew::Cmd::Unpin
This commit is contained in:
parent
5ccb0b0567
commit
f8caae06f7
@ -1,34 +1,32 @@
|
|||||||
# typed: true
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "abstract_command"
|
||||||
require "formula"
|
require "formula"
|
||||||
require "cli/parser"
|
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module Cmd
|
||||||
|
class Unpin < AbstractCommand
|
||||||
|
cmd_args do
|
||||||
|
description <<~EOS
|
||||||
|
Unpin <formula>, allowing them to be upgraded by `brew upgrade` <formula>.
|
||||||
|
See also `pin`.
|
||||||
|
EOS
|
||||||
|
|
||||||
sig { returns(CLI::Parser) }
|
named_args :installed_formula, min: 1
|
||||||
def unpin_args
|
end
|
||||||
Homebrew::CLI::Parser.new do
|
|
||||||
description <<~EOS
|
|
||||||
Unpin <formula>, allowing them to be upgraded by `brew upgrade` <formula>.
|
|
||||||
See also `pin`.
|
|
||||||
EOS
|
|
||||||
|
|
||||||
named_args :installed_formula, min: 1
|
sig { override.void }
|
||||||
end
|
def run
|
||||||
end
|
args.named.to_resolved_formulae.each do |f|
|
||||||
|
if f.pinned?
|
||||||
def unpin
|
f.unpin
|
||||||
args = unpin_args.parse
|
elsif !f.pinnable?
|
||||||
|
onoe "#{f.name} not installed"
|
||||||
args.named.to_resolved_formulae.each do |f|
|
else
|
||||||
if f.pinned?
|
opoo "#{f.name} not pinned"
|
||||||
f.unpin
|
end
|
||||||
elsif !f.pinnable?
|
end
|
||||||
onoe "#{f.name} not installed"
|
|
||||||
else
|
|
||||||
opoo "#{f.name} not pinned"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "cmd/shared_examples/args_parse"
|
require "cmd/shared_examples/args_parse"
|
||||||
|
require "cmd/unpin"
|
||||||
|
|
||||||
RSpec.describe "brew unpin" do
|
RSpec.describe Homebrew::Cmd::Unpin do
|
||||||
it_behaves_like "parseable arguments"
|
it_behaves_like "parseable arguments"
|
||||||
|
|
||||||
it "unpins a Formula's version", :integration_test do
|
it "unpins a Formula's version", :integration_test do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user