Revert "ARGV: Deprecate ARGV.flags_only and replace with Homebrew.args.flags_only"
This commit is contained in:
parent
53fe2c94db
commit
ae353ff42e
@ -1,6 +1,10 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module HomebrewArgvExtension
|
module HomebrewArgvExtension
|
||||||
|
def flags_only
|
||||||
|
select { |arg| arg.start_with?("--") }
|
||||||
|
end
|
||||||
|
|
||||||
def value(name)
|
def value(name)
|
||||||
arg_prefix = "--#{name}="
|
arg_prefix = "--#{name}="
|
||||||
flag_with_value = find { |arg| arg.start_with?(arg_prefix) }
|
flag_with_value = find { |arg| arg.start_with?(arg_prefix) }
|
||||||
|
|||||||
@ -11,7 +11,6 @@ require "patch"
|
|||||||
require "compilers"
|
require "compilers"
|
||||||
require "global"
|
require "global"
|
||||||
require "os/mac/version"
|
require "os/mac/version"
|
||||||
require "cli/parser"
|
|
||||||
|
|
||||||
class SoftwareSpec
|
class SoftwareSpec
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
@ -42,7 +41,7 @@ class SoftwareSpec
|
|||||||
@bottle_specification = BottleSpecification.new
|
@bottle_specification = BottleSpecification.new
|
||||||
@patches = []
|
@patches = []
|
||||||
@options = Options.new
|
@options = Options.new
|
||||||
@flags = Homebrew.args.flags_only
|
@flags = ARGV.flags_only
|
||||||
@deprecated_flags = []
|
@deprecated_flags = []
|
||||||
@deprecated_options = []
|
@deprecated_options = []
|
||||||
@build = BuildOptions.new(Options.create(@flags), options)
|
@build = BuildOptions.new(Options.create(@flags), options)
|
||||||
|
|||||||
@ -31,6 +31,14 @@ describe HomebrewArgvExtension do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#flags_only" do
|
||||||
|
let(:argv) { ["--foo", "-vds", "a", "b", "cdefg"] }
|
||||||
|
|
||||||
|
it "returns an array of flags" do
|
||||||
|
expect(subject.flags_only).to eq ["--foo"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#empty?" do
|
describe "#empty?" do
|
||||||
let(:argv) { [] }
|
let(:argv) { [] }
|
||||||
|
|
||||||
|
|||||||
@ -76,8 +76,7 @@ describe Messages do
|
|||||||
# rubocop:disable RSpec/VerifiedDoubles
|
# rubocop:disable RSpec/VerifiedDoubles
|
||||||
context "when the --display-times argument is present" do
|
context "when the --display-times argument is present" do
|
||||||
before do
|
before do
|
||||||
allow(Homebrew).to receive(:args)
|
allow(Homebrew).to receive(:args).and_return(double(display_times?: true))
|
||||||
.and_return(double(display_times?: true, flags_only: ["--display-times"]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when install_times is empty" do
|
context "when install_times is empty" do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user