blob: 5a14f853cee2cf3d7851c75f132d0956a0637c9a (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 | #:  * `pin` <formulae>:
#:    Pin the specified <formulae>, preventing them from being upgraded when
#:    issuing the `brew upgrade <formulae>` command (but can still be upgraded
#:    as dependencies for other formulae). See also `unpin`.
require "formula"
module Homebrew
  module_function
  def pin
    raise FormulaUnspecifiedError if ARGV.named.empty?
    ARGV.resolved_formulae.each do |f|
      if f.pinned?
        opoo "#{f.name} already pinned"
      elsif !f.pinnable?
        onoe "#{f.name} not installed"
      else
        f.pin
      end
    end
  end
end
 |