From aaa76434ac4760764b4c7bad6b3dfb0bb97c18e6 Mon Sep 17 00:00:00 2001 From: Jake Zimmerman Date: Thu, 13 Oct 2022 15:20:11 -0700 Subject: [PATCH] Allow passing `--ignore-files` multiple times --- lib/syntax_tree/cli.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/syntax_tree/cli.rb b/lib/syntax_tree/cli.rb index f3564e29..b839d562 100644 --- a/lib/syntax_tree/cli.rb +++ b/lib/syntax_tree/cli.rb @@ -290,7 +290,7 @@ class Options :target_ruby_version def initialize(print_width: DEFAULT_PRINT_WIDTH) - @ignore_files = "" + @ignore_files = [] @plugins = [] @print_width = print_width @scripts = [] @@ -313,7 +313,7 @@ def parser # Any of the CLI commands that operate on filenames will then ignore # this set of files. opts.on("--ignore-files=GLOB") do |glob| - @ignore_files = glob.match(/\A'(.*)'\z/) ? $1 : glob + @ignore_files << (glob.match(/\A'(.*)'\z/) ? $1 : glob) end # If there are any plugins specified on the command line, then load @@ -434,7 +434,7 @@ def run(argv) .glob(pattern) .each do |filepath| if File.readable?(filepath) && - !File.fnmatch?(options.ignore_files, filepath) + options.ignore_files.none? { File.fnmatch?(_1, filepath) } queue << FileItem.new(filepath) end end