tap-pin: Use CLI::Parser to parse args
This commit is contained in:
parent
a8aed381ca
commit
683c2b64f2
@ -2,10 +2,26 @@
|
|||||||
#: Pin <tap>, prioritizing its formulae over core when formula names are supplied
|
#: Pin <tap>, prioritizing its formulae over core when formula names are supplied
|
||||||
#: by the user. See also `tap-unpin`.
|
#: by the user. See also `tap-unpin`.
|
||||||
|
|
||||||
|
require "cli_parser"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
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
|
def tap_pin
|
||||||
|
tap_pin_args.parse
|
||||||
|
|
||||||
ARGV.named.each do |name|
|
ARGV.named.each do |name|
|
||||||
tap = Tap.fetch(name)
|
tap = Tap.fetch(name)
|
||||||
raise "pinning #{tap} is not allowed" if tap.core_tap?
|
raise "pinning #{tap} is not allowed" if tap.core_tap?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user