Skip to content

Commit aaa7643

Browse files
committed
Allow passing --ignore-files multiple times
1 parent cb72efc commit aaa7643

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/syntax_tree/cli.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ class Options
290290
:target_ruby_version
291291

292292
def initialize(print_width: DEFAULT_PRINT_WIDTH)
293-
@ignore_files = ""
293+
@ignore_files = []
294294
@plugins = []
295295
@print_width = print_width
296296
@scripts = []
@@ -313,7 +313,7 @@ def parser
313313
# Any of the CLI commands that operate on filenames will then ignore
314314
# this set of files.
315315
opts.on("--ignore-files=GLOB") do |glob|
316-
@ignore_files = glob.match(/\A'(.*)'\z/) ? $1 : glob
316+
@ignore_files << (glob.match(/\A'(.*)'\z/) ? $1 : glob)
317317
end
318318

319319
# If there are any plugins specified on the command line, then load
@@ -434,7 +434,7 @@ def run(argv)
434434
.glob(pattern)
435435
.each do |filepath|
436436
if File.readable?(filepath) &&
437-
!File.fnmatch?(options.ignore_files, filepath)
437+
options.ignore_files.none? { File.fnmatch?(_1, filepath) }
438438
queue << FileItem.new(filepath)
439439
end
440440
end

0 commit comments

Comments
 (0)