Merge pull request #10800 from gromgit/prefix-fix
--prefix: shortlist only formulae
This commit is contained in:
		
						commit
						5240afbbb5
					
				@ -17,10 +17,13 @@ homebrew-prefix() {
 | 
			
		||||
  [ -z "$formula" ] && echo "$HOMEBREW_PREFIX" && return 0
 | 
			
		||||
 | 
			
		||||
  local formula_path
 | 
			
		||||
  if [ -f "$HOMEBREW_REPOSITORY/Library/Taps/homebrew/homebrew-core/${formula}.rb" ]; then
 | 
			
		||||
    formula_path="$HOMEBREW_REPOSITORY/Library/Taps/homebrew/homebrew-core/${formula}.rb"
 | 
			
		||||
  if [ -f "$HOMEBREW_REPOSITORY/Library/Taps/homebrew/homebrew-core/Formula/${formula}.rb" ]; then
 | 
			
		||||
    formula_path="$HOMEBREW_REPOSITORY/Library/Taps/homebrew/homebrew-core/Formula/${formula}.rb"
 | 
			
		||||
  else
 | 
			
		||||
    formula_path="$(find "$HOMEBREW_REPOSITORY/Library/Taps" -name "${formula}.rb" -print -quit)"
 | 
			
		||||
    formula_path="$(
 | 
			
		||||
      shopt -s nullglob
 | 
			
		||||
      echo "$HOMEBREW_REPOSITORY/Library/Taps"/*/*/{Formula/,HomebrewFormula/,}"${formula}.rb"
 | 
			
		||||
    )"
 | 
			
		||||
  fi
 | 
			
		||||
  [ -z "$formula_path" ] && return 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,7 @@ describe "brew --prefix" do
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "errors if the given Formula doesn't exist", :integration_test do
 | 
			
		||||
    expect { brew "--prefix", "--installed", "nonexistent" }
 | 
			
		||||
    expect { brew "--prefix", "nonexistent" }
 | 
			
		||||
      .to output(/No available formula/).to_stderr
 | 
			
		||||
      .and not_to_output.to_stdout
 | 
			
		||||
      .and be_a_failure
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user