File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -169,22 +169,18 @@ def option_to_name(option)
169
169
170
170
sig { returns ( T ::Array [ String ] ) }
171
171
def cli_args
172
- return @cli_args if @cli_args
173
-
174
- @cli_args = [ ]
175
- @processed_options . each do |short , long |
172
+ @cli_args ||= @processed_options . filter_map do |short , long |
176
173
option = long || short
177
174
switch = :"#{ option_to_name ( option ) } ?"
178
175
flag = option_to_name ( option ) . to_sym
179
176
if @table [ switch ] == true || @table [ flag ] == true
180
- @cli_args << option
177
+ option
181
178
elsif @table [ flag ] . instance_of? String
182
- @cli_args << "#{ option } =#{ @table [ flag ] } "
179
+ "#{ option } =#{ @table [ flag ] } "
183
180
elsif @table [ flag ] . instance_of? Array
184
- @cli_args << "#{ option } =#{ @table [ flag ] . join ( "," ) } "
181
+ "#{ option } =#{ @table [ flag ] . join ( "," ) } "
185
182
end
186
- end
187
- @cli_args . freeze
183
+ end . freeze
188
184
end
189
185
end
190
186
end
You can’t perform that action at this time.
0 commit comments