argv: move flags_only to cli/args
This commit is contained in:
parent
f98efa11ab
commit
c7681c4287
@ -28,6 +28,14 @@ module Homebrew
|
||||
.map(&method(:to_cli_option))
|
||||
.select { |arg| arg.start_with?("-") }
|
||||
end
|
||||
|
||||
def flags_only
|
||||
to_h.keys
|
||||
.map(&:to_s)
|
||||
.reject { |name| %w[argv remaining].include?(name) }
|
||||
.map(&method(:to_cli_option))
|
||||
.select { |arg| arg.start_with?("--") }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -162,7 +162,7 @@ module Homebrew
|
||||
tab = Tab.for_keg(keg)
|
||||
end
|
||||
|
||||
build_options = BuildOptions.new(Options.create(ARGV.flags_only), f.options)
|
||||
build_options = BuildOptions.new(Options.create(Homebrew.args.flags_only), f.options)
|
||||
options = build_options.used_options
|
||||
options |= f.build.used_options
|
||||
options &= f.options
|
||||
|
||||
@ -16,7 +16,7 @@ module Homebrew
|
||||
backup keg
|
||||
end
|
||||
|
||||
build_options = BuildOptions.new(Options.create(ARGV.flags_only), f.options)
|
||||
build_options = BuildOptions.new(Options.create(Homebrew.args.flags_only), f.options)
|
||||
options = build_options.used_options
|
||||
options |= f.build.used_options
|
||||
options &= f.options
|
||||
|
||||
@ -225,5 +225,10 @@ describe Homebrew::CLI::Parser do
|
||||
parser.parse(["--foo", "-vds", "a", "b", "cdefg"])
|
||||
expect(Homebrew.args.options_only).to eq %w[--foo -v -d -s]
|
||||
end
|
||||
|
||||
it "#flags_only" do
|
||||
parser.parse(["--foo", "-vds", "a", "b", "cdefg"])
|
||||
expect(Homebrew.args.flags_only).to eq %w[--foo]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user