2016-04-08 16:28:43 +02:00
|
|
|
#: * `pin` <formulae>:
|
|
|
|
#: Pin the specified <formulae>, preventing them from being upgraded when
|
2018-02-05 09:31:17 +00:00
|
|
|
#: issuing the `brew upgrade <formulae>` command. See also `unpin`.
|
2016-04-08 16:28:43 +02:00
|
|
|
|
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
|
2016-09-26 01:44:51 +02:00
|
|
|
module_function
|
|
|
|
|
2013-03-11 16:41:08 +01:00
|
|
|
def pin
|
|
|
|
raise FormulaUnspecifiedError if ARGV.named.empty?
|
2013-04-16 01:43:26 -05:00
|
|
|
|
2015-05-17 21:06:23 +08:00
|
|
|
ARGV.resolved_formulae.each do |f|
|
2013-04-16 01:43:26 -05:00
|
|
|
if f.pinned?
|
|
|
|
opoo "#{f.name} already pinned"
|
|
|
|
elsif !f.pinnable?
|
|
|
|
onoe "#{f.name} not installed"
|
|
|
|
else
|
|
|
|
f.pin
|
|
|
|
end
|
2013-03-11 16:41:08 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|