CLI::Args: Make processed_options read-only

This commit is contained in:
Gautham Goli 2019-12-11 00:23:51 +05:30
parent 28e62b52d1
commit 2b95755afe
2 changed files with 9 additions and 3 deletions

View File

@ -5,7 +5,7 @@ require "ostruct"
module Homebrew
module CLI
class Args < OpenStruct
attr_accessor :processed_options, :args_parsed
attr_reader :processed_options, :args_parsed
# undefine tap to allow --tap argument
undef tap
@ -16,6 +16,12 @@ module Homebrew
@processed_options = []
end
def freeze_processed_options!(processed_options)
@processed_options += processed_options
@processed_options.freeze
@args_parsed = true
end
def option_to_name(option)
option.sub(/\A--?/, "")
.tr("-", "_")

View File

@ -140,10 +140,10 @@ module Homebrew
end
check_constraint_violations
@args[:remaining] = remaining_args
@args.args_parsed = @args_parsed = true
@args.processed_options = @processed_options
@args.freeze_processed_options!(@processed_options)
Homebrew.args = @args
cmdline_args.freeze
@args_parsed = true
@parser
end