Port Homebrew::DevCmd::Unpack
This commit is contained in:
parent
ba5f392d4c
commit
bdf8fbc1ad
@ -1,14 +1,18 @@
|
|||||||
# typed: true
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "abstract_command"
|
||||||
|
require "fileutils"
|
||||||
require "stringio"
|
require "stringio"
|
||||||
require "formula"
|
require "formula"
|
||||||
require "cli/parser"
|
require "cli/parser"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
sig { returns(CLI::Parser) }
|
module DevCmd
|
||||||
def self.unpack_args
|
class Unpack < AbstractCommand
|
||||||
Homebrew::CLI::Parser.new do
|
include FileUtils
|
||||||
|
|
||||||
|
cmd_args do
|
||||||
description <<~EOS
|
description <<~EOS
|
||||||
Unpack the source files for <formula> into subdirectories of the current
|
Unpack the source files for <formula> into subdirectories of the current
|
||||||
working directory.
|
working directory.
|
||||||
@ -27,11 +31,9 @@ module Homebrew
|
|||||||
|
|
||||||
named_args :formula, min: 1
|
named_args :formula, min: 1
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def self.unpack
|
|
||||||
args = unpack_args.parse
|
|
||||||
|
|
||||||
|
sig { override.void }
|
||||||
|
def run
|
||||||
formulae = args.named.to_formulae
|
formulae = args.named.to_formulae
|
||||||
|
|
||||||
if (dir = args.destdir)
|
if (dir = args.destdir)
|
||||||
@ -72,4 +74,6 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "cmd/shared_examples/args_parse"
|
require "cmd/shared_examples/args_parse"
|
||||||
|
require "dev-cmd/unpack"
|
||||||
|
|
||||||
RSpec.describe "brew unpack" do
|
RSpec.describe Homebrew::DevCmd::Unpack do
|
||||||
it_behaves_like "parseable arguments"
|
it_behaves_like "parseable arguments"
|
||||||
|
|
||||||
it "unpacks a given Formula's archive", :integration_test do
|
it "unpacks a given Formula's archive", :integration_test do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user