2020-11-25 17:03:23 +01:00
|
|
|
# typed: true
|
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:15:18 +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:30 +00:00
|
|
|
def __cellar_args
|
|
|
|
Homebrew::CLI::Parser.new do
|
|
|
|
usage_banner <<~EOS
|
2019-03-09 13:00:15 -05:00
|
|
|
`--cellar` [<formula>]
|
2019-01-30 21:29:30 +00:00
|
|
|
|
|
|
|
Display Homebrew's Cellar path. *Default:* `$(brew --prefix)/Cellar`, or if
|
|
|
|
that directory doesn't exist, `$(brew --repository)/Cellar`.
|
|
|
|
|
2020-04-18 12:13:43 -04:00
|
|
|
If <formula> is provided, display the location in the Cellar where <formula>
|
2019-01-30 21:29:30 +00:00
|
|
|
would be installed, without any sort of versioned directory as the last path.
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-09-11 20:22:54 +01:00
|
|
|
def __cellar
|
2020-07-30 18:40:10 +02:00
|
|
|
args = __cellar_args.parse
|
2019-01-30 21:29:30 +00:00
|
|
|
|
2020-03-04 17:28:15 +00:00
|
|
|
if args.no_named?
|
2010-09-11 20:22:54 +01:00
|
|
|
puts HOMEBREW_CELLAR
|
|
|
|
else
|
2020-08-19 10:34:48 -04:00
|
|
|
puts args.named.to_resolved_formulae.map(&:rack)
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|