Port Homebrew::Cmd::TapInfo
This commit is contained in:
parent
5495ff1eea
commit
be42d46d49
@ -1,14 +1,12 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cli/parser"
|
||||
require "abstract_command"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
sig { returns(CLI::Parser) }
|
||||
def tap_info_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
module Cmd
|
||||
class TapInfo < AbstractCommand
|
||||
cmd_args do
|
||||
description <<~EOS
|
||||
Show detailed information about one or more <tap>s.
|
||||
If no <tap> names are provided, display brief statistics for all installed taps.
|
||||
@ -22,11 +20,9 @@ module Homebrew
|
||||
|
||||
named_args :tap
|
||||
end
|
||||
end
|
||||
|
||||
def tap_info
|
||||
args = tap_info_args.parse
|
||||
|
||||
sig { override.void }
|
||||
def run
|
||||
taps = if args.installed?
|
||||
Tap
|
||||
else
|
||||
@ -42,6 +38,8 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def print_tap_info(taps)
|
||||
if taps.none?
|
||||
tap_count = 0
|
||||
@ -85,4 +83,6 @@ module Homebrew
|
||||
def print_tap_json(taps)
|
||||
puts JSON.pretty_generate(taps.map(&:to_hash))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,8 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cmd/shared_examples/args_parse"
|
||||
require "cmd/tap-info"
|
||||
|
||||
RSpec.describe "brew tap-info" do
|
||||
RSpec.describe Homebrew::Cmd::TapInfo do
|
||||
it_behaves_like "parseable arguments"
|
||||
|
||||
it "gets information for a given Tap", :integration_test, :needs_network do
|
||||
|
Loading…
x
Reference in New Issue
Block a user