#!/usr/bin/env ruby require 'thor' require 'yagg' class YaggRunner < Thor desc 'generate IN [OUT]', 'generate a ruby file from given .y file' def generate(infile, outfile = "-") u = Yagg::Parser.new File.read infile u.parse v = Yagg::Generator.new u.result if outfile == "-" puts v.generate else open(outfile, "w") do |f| f.write v.generate end end end start ARGV end