Skip to content

Commit

Permalink
Merge pull request #16096 from EricFromCanada/cli-args-extras
Browse files Browse the repository at this point in the history
cli/parser: depopulate commands' internal args lists
  • Loading branch information
MikeMcQuaid committed Oct 8, 2023
2 parents eef9f84 + abeab3e commit 5349b76
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Library/Homebrew/cli/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@ def set_switch(*names, value:, from:)
end
end

def disable_switch(*names)
names.each do |name|
def disable_switch(*args)
args.each do |name|
@args["#{option_to_name(name)}?"] = if name.start_with?("--[no-]")
nil
else
Expand Down Expand Up @@ -614,6 +614,7 @@ def process_option(*args, type:, hidden: false)
@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]

args.pop # last argument is the description
if type == :switch
disable_switch(*args)
else
Expand Down

0 comments on commit 5349b76

Please sign in to comment.