brew/Library/Homebrew/cmd/--cellar.rb

33 lines
741 B
Ruby
Raw Normal View History

2020-11-25 17:03:23 +01:00
# typed: true
# frozen_string_literal: true
2019-04-17 18:25:08 +09:00
require "cli/parser"
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
`--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`.
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
def __cellar
2020-07-30 18:40:10 +02:00
args = __cellar_args.parse
2019-01-30 21:29:30 +00:00
if args.no_named?
puts HOMEBREW_CELLAR
else
puts args.named.to_resolved_formulae.map(&:rack)
end
end
end