@@ -129,26 +129,25 @@ def self.parse_opts(argv)
129129 Options . parse_options ( argv , options )
130130 end
131131
132+ # Generic overrides
133+ def self . setup_overrides ( key , options )
134+ o = options [ "#{ key } _in" . to_sym ]
135+ return unless o . is_a? ( Array )
136+ return unless o . any?
137+ options [ key ] ||= [ ]
138+ options [ key ] . concat o . map { |x | OctocatalogDiff ::API ::V1 ::Override . create_from_input ( x ) }
139+ end
140+
132141 # Fact overrides come in here
133142 def self . setup_fact_overrides ( options )
134- [ :from_fact_override , :to_fact_override ] . each do |key |
135- o = options [ "#{ key } _in" . to_sym ]
136- next unless o . is_a? ( Array )
137- next unless o . any?
138- options [ key ] ||= [ ]
139- options [ key ] . concat o . map { |x | OctocatalogDiff ::API ::V1 ::Override . create_from_input ( x ) }
140- end
143+ setup_overrides ( :from_fact_override , options )
144+ setup_overrides ( :to_fact_override , options )
141145 end
142146
143147 # ENC parameter overrides come in here
144148 def self . setup_enc_overrides ( options )
145- [ :from_enc_override , :to_enc_override ] . each do |key |
146- o = options [ "#{ key } _in" . to_sym ]
147- next unless o . is_a? ( Array )
148- next unless o . any?
149- options [ key ] ||= [ ]
150- options [ key ] . concat o . map { |x | OctocatalogDiff ::API ::V1 ::Override . create_from_input ( x ) }
151- end
149+ setup_overrides ( :from_enc_override , options )
150+ setup_overrides ( :to_enc_override , options )
152151 end
153152
154153 # Helper method: Configure and setup logger
0 commit comments