CLI::Args: Make processed_options read-only
This commit is contained in:
parent
28e62b52d1
commit
2b95755afe
@ -5,7 +5,7 @@ require "ostruct"
|
|||||||
module Homebrew
|
module Homebrew
|
||||||
module CLI
|
module CLI
|
||||||
class Args < OpenStruct
|
class Args < OpenStruct
|
||||||
attr_accessor :processed_options, :args_parsed
|
attr_reader :processed_options, :args_parsed
|
||||||
# undefine tap to allow --tap argument
|
# undefine tap to allow --tap argument
|
||||||
undef tap
|
undef tap
|
||||||
|
|
||||||
@ -16,6 +16,12 @@ module Homebrew
|
|||||||
@processed_options = []
|
@processed_options = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def freeze_processed_options!(processed_options)
|
||||||
|
@processed_options += processed_options
|
||||||
|
@processed_options.freeze
|
||||||
|
@args_parsed = true
|
||||||
|
end
|
||||||
|
|
||||||
def option_to_name(option)
|
def option_to_name(option)
|
||||||
option.sub(/\A--?/, "")
|
option.sub(/\A--?/, "")
|
||||||
.tr("-", "_")
|
.tr("-", "_")
|
||||||
|
|||||||
@ -140,10 +140,10 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
check_constraint_violations
|
check_constraint_violations
|
||||||
@args[:remaining] = remaining_args
|
@args[:remaining] = remaining_args
|
||||||
@args.args_parsed = @args_parsed = true
|
@args.freeze_processed_options!(@processed_options)
|
||||||
@args.processed_options = @processed_options
|
|
||||||
Homebrew.args = @args
|
Homebrew.args = @args
|
||||||
cmdline_args.freeze
|
cmdline_args.freeze
|
||||||
|
@args_parsed = true
|
||||||
@parser
|
@parser
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user