aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/--prefix.rb
blob: 07b43693c63f5f33085d3e9244b6112a07fec11d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#:  * `--prefix`:
#:    Display Homebrew's install path. *Default:* `/usr/local`
#:
#:  * `--prefix` <formula>:
#:    Display the location in the cellar where <formula> is or would be installed.

module Homebrew
  def __prefix
    if ARGV.named.empty?
      puts HOMEBREW_PREFIX
    else
      puts ARGV.resolved_formulae.map { |f| f.opt_prefix.exist? ? f.opt_prefix : f.installed_prefix }
    end
  end
end