Skip to content

Commit

Permalink
Add the ability to exclude file and folders from the search
Browse files Browse the repository at this point in the history
  • Loading branch information
aerostitch committed Mar 23, 2018
1 parent 84c41b9 commit a2d6644
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/yaml-lint
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ OptionParser.new do |opts|
options[:ignorenoyaml] = true
end

opts.on("-e x,y,z", "--exclude x,y,z", Array, "Coma-separated list of files or folders to exclude.") do |n|
options[:exclude] = n
end

opts.on_tail("-h", "--help") do |q|
puts 'yaml-lint is a tool to check the syntax of your YAML files'
puts opts
Expand Down
1 change: 1 addition & 0 deletions lib/yaml-lint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def do_lint

def parse_directory(directory)
Dir.glob("#{directory}/*").inject(0) do |mem, fdir|
next mem if (Array(@config[:exclude])).include? File.basename(fdir)
if File.directory? fdir
mem + parse_directory(fdir)
else
Expand Down

0 comments on commit a2d6644

Please sign in to comment.