2024-04-01 11:48:40 -07:00
|
|
|
# typed: strict
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-04-01 11:48:40 -07:00
|
|
|
require "abstract_command"
|
2015-08-03 13:09:07 +01:00
|
|
|
require "formula"
|
2013-03-11 16:41:08 +01:00
|
|
|
|
2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2024-04-01 11:48:40 -07:00
|
|
|
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
|
2016-09-26 01:44:51 +02:00
|
|
|
|
2024-04-01 11:48:40 -07:00
|
|
|
named_args :installed_formula, min: 1
|
|
|
|
end
|
2018-11-11 18:23:14 +05:30
|
|
|
|
2024-04-01 11:48:40 -07:00
|
|
|
sig { override.void }
|
|
|
|
def run
|
|
|
|
args.named.to_resolved_formulae.each do |f|
|
|
|
|
if f.pinned?
|
|
|
|
f.unpin
|
|
|
|
elsif !f.pinnable?
|
|
|
|
onoe "#{f.name} not installed"
|
|
|
|
else
|
|
|
|
opoo "#{f.name} not pinned"
|
|
|
|
end
|
|
|
|
end
|
2013-04-16 01:43:26 -05:00
|
|
|
end
|
2013-03-11 16:41:08 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|