2020-11-25 17:03:23 +01:00
|
|
|
# typed: true
|
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
|
2020-10-20 12:03:48 +02:00
|
|
|
extend T::Sig
|
|
|
|
|
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
|
|
|
|
usage_banner <<~EOS
|
2019-08-06 14:17:17 -04:00
|
|
|
`--repository`, `--repo` [<user>`/`<repo>]
|
2019-01-30 21:29:49 +00:00
|
|
|
|
|
|
|
Display where Homebrew's `.git` directory is located.
|
|
|
|
|
|
|
|
If <user>`/`<repo> are provided, display where tap <user>`/`<repo>'s directory is located.
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
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
|
2020-03-04 17:28:15 +00:00
|
|
|
puts args.named.map { |tap| Tap.fetch(tap).path }
|
2016-03-23 16:33:40 +08:00
|
|
|
end
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
end
|