pin: Use CLI::Parser to parse args
This commit is contained in:
		
							parent
							
								
									b0f382c177
								
							
						
					
					
						commit
						f9883a9222
					
				@ -3,12 +3,27 @@
 | 
			
		||||
#:    issuing the `brew upgrade` <formulae> 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` <formulae>
 | 
			
		||||
 | 
			
		||||
        Pin the specified <formulae>, preventing them from being upgraded when
 | 
			
		||||
        issuing the `brew upgrade` <formulae> 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?
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user