Port Homebrew::Cmd::Repository
This commit is contained in:
parent
6a1d43337c
commit
3f856f6516
@ -1,32 +1,32 @@
|
|||||||
# typed: strict
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "cli/parser"
|
require "abstract_command"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module Cmd
|
||||||
|
class Repository < AbstractCommand
|
||||||
|
sig { override.returns(String) }
|
||||||
|
def self.command_name = "--repository"
|
||||||
|
|
||||||
sig { returns(CLI::Parser) }
|
cmd_args do
|
||||||
def __repository_args
|
description <<~EOS
|
||||||
Homebrew::CLI::Parser.new do
|
Display where Homebrew's Git repository is located.
|
||||||
description <<~EOS
|
|
||||||
Display where Homebrew's Git repository is located.
|
|
||||||
|
|
||||||
If <user>`/`<repo> are provided, display where tap <user>`/`<repo>'s directory is located.
|
If <user>`/`<repo> are provided, display where tap <user>`/`<repo>'s directory is located.
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
named_args :tap
|
named_args :tap
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
sig { void }
|
sig { override.void }
|
||||||
def __repository
|
def run
|
||||||
args = __repository_args.parse
|
if args.no_named?
|
||||||
|
puts HOMEBREW_REPOSITORY
|
||||||
if args.no_named?
|
else
|
||||||
puts HOMEBREW_REPOSITORY
|
puts args.named.to_taps.map(&:path)
|
||||||
else
|
end
|
||||||
puts args.named.to_taps.map(&:path)
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "cmd/--repository"
|
||||||
require "cmd/shared_examples/args_parse"
|
require "cmd/shared_examples/args_parse"
|
||||||
|
|
||||||
RSpec.describe "brew --repository" do
|
RSpec.describe Homebrew::Cmd::Repository do
|
||||||
it_behaves_like "parseable arguments"
|
it_behaves_like "parseable arguments"
|
||||||
|
|
||||||
it "prints Homebrew's repository", :integration_test do
|
it "prints Homebrew's repository", :integration_test do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user