Port Homebrew::Cmd::Tap
This commit is contained in:
parent
be42d46d49
commit
841cfd9fdc
@ -1,14 +1,12 @@
|
||||
# typed: true
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cli/parser"
|
||||
require "abstract_command"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
sig { returns(CLI::Parser) }
|
||||
def tap_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
module Cmd
|
||||
class TapCmd < AbstractCommand
|
||||
cmd_args do
|
||||
usage_banner "`tap` [<options>] [<user>`/`<repo>] [<URL>]"
|
||||
description <<~EOS
|
||||
Tap a formula repository.
|
||||
@ -30,7 +28,8 @@ module Homebrew
|
||||
replacement: false,
|
||||
disable: true
|
||||
switch "--shallow",
|
||||
description: "Fetch tap as a shallow clone rather than a full clone. Useful for continuous integration.",
|
||||
description: "Fetch tap as a shallow clone rather than a full clone. Useful for continuous " \
|
||||
"integration.",
|
||||
replacement: false,
|
||||
disable: true
|
||||
switch "--[no-]force-auto-update",
|
||||
@ -47,12 +46,9 @@ module Homebrew
|
||||
|
||||
named_args :tap, max: 2
|
||||
end
|
||||
end
|
||||
|
||||
sig { void }
|
||||
def tap
|
||||
args = tap_args.parse
|
||||
|
||||
sig { override.void }
|
||||
def run
|
||||
if args.repair?
|
||||
Tap.installed.each do |tap|
|
||||
tap.link_completions_and_manpages
|
||||
@ -76,3 +72,5 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,8 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cmd/shared_examples/args_parse"
|
||||
require "cmd/tap"
|
||||
|
||||
RSpec.describe "brew tap" do
|
||||
RSpec.describe Homebrew::Cmd::TapCmd do
|
||||
it_behaves_like "parseable arguments"
|
||||
|
||||
it "taps a given Tap", :integration_test do
|
||||
|
Loading…
x
Reference in New Issue
Block a user