-
-
Save steveh/4980034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
fn = ARGV[0] | |
if !fn | |
puts "Usage: #{$0} file.mustache" | |
puts | |
exit | |
end | |
fields = [] | |
File.read(fn).split("\n").each do |l| | |
if l =~ /{{{(.+?)}}}/ || l =~ /{{(.+?)}}/ | |
next if $1[0,1] == '/' | |
field = $1 | |
field = field[1..-1] if field[0,1] == '#' | |
field = field[1..-1] if field[0,1] == '^' | |
fields << field | |
end | |
end | |
puts fields.sort.uniq.join("\n") | |
puts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
!/usr/bin/env ruby
fn = ARGV[0]
if !fn
puts "Usage: #{$0} file.mustache"
puts
exit
end
fields = []
File.read(fn).split("\n").each do |l|
if l =~ /{{{(.+?)}}}/ || l =~ /{{(.+?)}}/
next if $1[0,1] == '/'
field = $1
field = field[1..-1] if field[0,1] == '#'
field = field[1..-1] if f