Merge pull request #5294 from GauthamGoli/tap-pin-args

tap-pin: Use CLI::Parser to parse args
This commit is contained in:
Gautham Goli 2018-11-11 10:53:31 +05:30 committed by GitHub
commit e6117f358c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,10 +2,26 @@
#: Pin <tap>, prioritizing its formulae over core when formula names are supplied
#: by the user. See also `tap-unpin`.
require "cli_parser"
module Homebrew
module_function
def tap_pin_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`tap-pin` <tap>
Pin <tap>, prioritizing its formulae over core when formula names are supplied
by the user. See also `tap-unpin`.
EOS
switch :debug
end
end
def tap_pin
tap_pin_args.parse
ARGV.named.each do |name|
tap = Tap.fetch(name)
raise "pinning #{tap} is not allowed" if tap.core_tap?