diff --git a/misc/collect-min-version-macro.rb b/misc/collect-min-version-macro.rb index 267c4578..1e24fe54 100644 --- a/misc/collect-min-version-macro.rb +++ b/misc/collect-min-version-macro.rb @@ -2,18 +2,21 @@ base = ARGV[0] || "." -a = [] +h = {} Dir.glob("**/*.hs", base: base){|fname| File.open(fname, encoding: "utf-8"){|f| f.each_line{|l| if /MIN_VERSION_\w+\(\d+,\d+,\d+\)/ =~ l - a << $~[0] + (h[$~[0]] ||= []) << fname end } } } -a.sort.uniq.each{|l| - puts l +h.keys.sort.each {|k| + puts k + h[k].each {|fname| + puts " #{fname}" + } }