2023-08-08 13:54:59 -07:00
|
|
|
# typed: strict
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-04-17 18:25:08 +09:00
|
|
|
require "cli/parser"
|
2016-04-17 09:21:02 +02:00
|
|
|
|
2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2016-09-26 01:44:51 +02:00
|
|
|
module_function
|
|
|
|
|
2020-10-20 12:03:48 +02:00
|
|
|
sig { returns(CLI::Parser) }
|
2019-01-30 21:29:49 +00:00
|
|
|
def __repository_args
|
|
|
|
Homebrew::CLI::Parser.new do
|
2021-01-15 15:04:02 -05:00
|
|
|
description <<~EOS
|
2023-09-08 14:46:15 -04:00
|
|
|
Display where Homebrew's Git repository is located.
|
2019-01-30 21:29:49 +00:00
|
|
|
|
|
|
|
If <user>`/`<repo> are provided, display where tap <user>`/`<repo>'s directory is located.
|
|
|
|
EOS
|
2021-01-10 14:26:40 -05:00
|
|
|
|
|
|
|
named_args :tap
|
2019-01-30 21:29:49 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-08-08 13:54:59 -07:00
|
|
|
sig { void }
|
2010-09-11 20:22:54 +01:00
|
|
|
def __repository
|
2020-07-30 18:40:10 +02:00
|
|
|
args = __repository_args.parse
|
2019-01-30 21:29:49 +00:00
|
|
|
|
2020-03-04 17:28:15 +00:00
|
|
|
if args.no_named?
|
2016-03-23 16:33:40 +08:00
|
|
|
puts HOMEBREW_REPOSITORY
|
|
|
|
else
|
2021-01-10 14:26:40 -05:00
|
|
|
puts args.named.to_taps.map(&:path)
|
2016-03-23 16:33:40 +08:00
|
|
|
end
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
end
|