package com.mwc.util;

import java.io.*;

public class JavaTemplateTool {
   public static void main(String args[]) 
   throws Throwable {
      if(args.length != 4) {
         System.err.println("Usage: JavaTemplateTool <java template file> <type template> <type name> <output file name>");
         System.exit(1);
      }

      System.out.println(args[0] + " ==> " + args[3]);
      TemplateWebPage template = new TemplateWebPage();
      template.loadTemplate(args[0]);
      template.expandTemplate("#"+args[1]+"#", args[2]);
      FileWriter fw = new FileWriter(args[3]);
      template.sendTo(new PrintWriter(new BufferedWriter(fw)));
      fw.close();
      System.out.println("Done!");
   }
}