2024-04-01 15:56:06 -07:00
|
|
|
# typed: strict
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-04-01 15:56:06 -07:00
|
|
|
require "abstract_command"
|
2016-04-17 09:15:18 +02:00
|
|
|
|
2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2024-04-01 15:56:06 -07:00
|
|
|
module Cmd
|
|
|
|
class Cellar < AbstractCommand
|
|
|
|
sig { override.returns(String) }
|
|
|
|
def self.command_name = "--cellar"
|
2016-09-26 01:44:51 +02:00
|
|
|
|
2024-04-01 15:56:06 -07:00
|
|
|
cmd_args do
|
|
|
|
description <<~EOS
|
|
|
|
Display Homebrew's Cellar path. *Default:* `$(brew --prefix)/Cellar`, or if
|
|
|
|
that directory doesn't exist, `$(brew --repository)/Cellar`.
|
2019-01-30 21:29:30 +00:00
|
|
|
|
2024-04-01 15:56:06 -07:00
|
|
|
If <formula> is provided, display the location in the Cellar where <formula>
|
|
|
|
would be installed, without any sort of versioned directory as the last path.
|
|
|
|
EOS
|
2021-01-10 14:26:40 -05:00
|
|
|
|
2024-04-01 15:56:06 -07:00
|
|
|
named_args :formula
|
|
|
|
end
|
2019-01-30 21:29:30 +00:00
|
|
|
|
2024-04-01 15:56:06 -07:00
|
|
|
sig { override.void }
|
|
|
|
def run
|
|
|
|
if args.no_named?
|
|
|
|
puts HOMEBREW_CELLAR
|
|
|
|
else
|
|
|
|
puts args.named.to_resolved_formulae.map(&:rack)
|
|
|
|
end
|
|
|
|
end
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|