cli/parser: depopulate commands' args lists

This commit is contained in:
Eric Knibbe 2023-10-07 23:47:00 -04:00
parent eef9f84a80
commit d3959727d6
No known key found for this signature in database
GPG Key ID: 179D9CDDDB814168

View File

@ -515,8 +515,8 @@ module Homebrew
end end
end end
def disable_switch(*names) def disable_switch(*args)
names.each do |name| args.each do |name|
@args["#{option_to_name(name)}?"] = if name.start_with?("--[no-]") @args["#{option_to_name(name)}?"] = if name.start_with?("--[no-]")
nil nil
else else
@ -614,6 +614,7 @@ module Homebrew
@processed_options.reject! { |existing| existing.second == option.long.first } if option.long.first.present? @processed_options.reject! { |existing| existing.second == option.long.first } if option.long.first.present?
@processed_options << [option.short.first, option.long.first, option.arg, option.desc.first, hidden] @processed_options << [option.short.first, option.long.first, option.arg, option.desc.first, hidden]
args.select! { |a| a.start_with?("-") }
if type == :switch if type == :switch
disable_switch(*args) disable_switch(*args)
else else