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