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

36 lines
738 B
Ruby
Raw 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
module Homebrew
2020-10-20 12:03:48 +02:00
extend T::Sig
2020-08-03 12:02:20 -04:00
module_function
2020-10-20 12:03:48 +02:00
sig { returns(CLI::Parser) }
2020-08-03 12:02:20 -04:00
def __caskroom_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`--caskroom` [<cask>]
Display Homebrew's Caskroom path.
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
end
end
2020-10-20 12:03:48 +02:00
sig { void }
2020-08-03 12:02:20 -04:00
def __caskroom
args = __caskroom_args.parse
if args.named.to_casks.blank?
2020-08-03 12:02:20 -04:00
puts Cask::Caskroom.path
else
args.named.to_casks.each do |cask|
2020-08-03 12:02:20 -04:00
puts "#{Cask::Caskroom.path}/#{cask.token}"
end
end
end
end