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

36 lines
817 B
Ruby
Raw Permalink Normal View History

2020-10-20 12:03:48 +02:00
# typed: strict
2020-08-03 12:02:20 -04:00
# frozen_string_literal: true
2024-04-01 15:53:44 -07:00
require "abstract_command"
2020-08-03 12:02:20 -04:00
module Homebrew
2024-04-01 15:53:44 -07:00
module Cmd
class Caskroom < AbstractCommand
sig { override.returns(String) }
def self.command_name = "--caskroom"
2020-08-03 12:02:20 -04:00
2024-04-01 15:53:44 -07:00
cmd_args do
description <<~EOS
Display Homebrew's Caskroom path.
2021-01-10 14:26:40 -05:00
2024-04-01 15:53:44 -07:00
If <cask> is provided, display the location in the Caskroom where <cask>
would be installed, without any sort of versioned directory as the last path.
EOS
2020-08-03 12:02:20 -04:00
2024-04-01 15:53:44 -07:00
named_args :cask
end
2020-08-03 12:02:20 -04:00
2024-04-01 15:53:44 -07:00
sig { override.void }
def run
if args.named.to_casks.blank?
puts Cask::Caskroom.path
else
args.named.to_casks.each do |cask|
puts "#{Cask::Caskroom.path}/#{cask.token}"
end
end
2020-08-03 12:02:20 -04:00
end
end
end
end