Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Allow passing --ignore-files multiple times
  • Loading branch information
jez committed Oct 13, 2022
commit aaa76434ac4760764b4c7bad6b3dfb0bb97c18e6
6 changes: 3 additions & 3 deletions lib/syntax_tree/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down