--prefix: use CLI::Parser.
This commit is contained in:
		
							parent
							
								
									515d4c023d
								
							
						
					
					
						commit
						b521ba0c7a
					
				@ -1,13 +1,25 @@
 | 
			
		||||
#:  * `--prefix`:
 | 
			
		||||
#:    Display Homebrew's install path. *Default:* `/usr/local` on macOS and `/home/linuxbrew/.linuxbrew` on Linux
 | 
			
		||||
#:
 | 
			
		||||
#:  * `--prefix` <formula>:
 | 
			
		||||
#:    Display the location in the cellar where <formula> is or would be installed.
 | 
			
		||||
require "cli_parser"
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
  module_function
 | 
			
		||||
 | 
			
		||||
  def __prefix_args
 | 
			
		||||
    Homebrew::CLI::Parser.new do
 | 
			
		||||
      usage_banner <<~EOS
 | 
			
		||||
        `--prefix` [<formula>]
 | 
			
		||||
 | 
			
		||||
        Display Homebrew's install path. *Default:* `/usr/local` on macOS and
 | 
			
		||||
        `/home/linuxbrew/.linuxbrew` on Linux.
 | 
			
		||||
 | 
			
		||||
        If <formula> is provided, display the location in the cellar where <formula>
 | 
			
		||||
        is or would be installed.
 | 
			
		||||
      EOS
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def __prefix
 | 
			
		||||
    __prefix_args.parse
 | 
			
		||||
 | 
			
		||||
    if ARGV.named.empty?
 | 
			
		||||
      puts HOMEBREW_PREFIX
 | 
			
		||||
    else
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user