34 lines
700 B
Ruby
Raw Normal View History

2024-04-01 11:48:40 -07:00
# typed: strict
# frozen_string_literal: true
2024-04-01 11:48:40 -07:00
require "abstract_command"
require "formula"
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
end
end
end
end