aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/--prefix.rb
blob: 956ab0403c9d5a29e7cf39ef3825a19b11bb8bfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#:  * `--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
  module_function

  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