From f9883a922218158944615efed9217ab7ae93caa8 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Sun, 11 Nov 2018 20:06:40 +0530 Subject: [PATCH] pin: Use CLI::Parser to parse args --- Library/Homebrew/cmd/pin.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/pin.rb b/Library/Homebrew/cmd/pin.rb index df52c42b03..e93ce5938b 100644 --- a/Library/Homebrew/cmd/pin.rb +++ b/Library/Homebrew/cmd/pin.rb @@ -3,12 +3,27 @@ #: issuing the `brew upgrade` command. See also `unpin`. require "formula" +require "cli_parser" module Homebrew module_function + def pin_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `pin` + + Pin the specified , preventing them from being upgraded when + issuing the `brew upgrade` command. See also `unpin`. + EOS + switch :debug + end + end + def pin - raise FormulaUnspecifiedError if ARGV.named.empty? + pin_args.parse + + raise FormulaUnspecifiedError if args.remaining.empty? ARGV.resolved_formulae.each do |f| if f.pinned?