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

35 lines
861 B
Ruby
Raw Permalink Normal View History

2024-04-01 15:56:06 -07:00
# typed: strict
# frozen_string_literal: true
2024-04-01 15:56:06 -07:00
require "abstract_command"
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
end
end
end