2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-04-17 18:25:08 +09:00
|
|
|
require "cli/parser"
|
2016-04-17 09:19:35 +02:00
|
|
|
|
2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2016-09-26 01:44:51 +02:00
|
|
|
module_function
|
|
|
|
|
2019-01-30 21:29:43 +00:00
|
|
|
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
|
|
|
|
|
2010-09-11 20:22:54 +01:00
|
|
|
def __prefix
|
2019-01-30 21:29:43 +00:00
|
|
|
__prefix_args.parse
|
|
|
|
|
2019-12-15 23:50:01 +05:30
|
|
|
if Homebrew.args.named.blank?
|
2010-09-11 20:22:54 +01:00
|
|
|
puts HOMEBREW_PREFIX
|
|
|
|
else
|
2019-12-19 13:56:26 +05:30
|
|
|
puts Homebrew.args.resolved_formulae.map { |f|
|
2017-02-12 16:17:56 +00:00
|
|
|
f.opt_prefix.exist? ? f.opt_prefix : f.installed_prefix
|
|
|
|
}
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|