quick render commandline

"Zemian Deng" <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Hi,

I notice there is a freefreemarker.core.CommandLine class, which just
print FM version. It would be nice to also accept template file as
argument and process them with just empty model. This can provide
quick testing.

Just a simple thing like this will help:

public static void main(String[] args) {
			if(args.length>0){
				Configuration cfg = new Configuration();
				Template template = cfg.getTemplate(args[0]);
				java.io.Writer out = new OutputStreamWriter(System.out);
				template.process(new java.util.HashMap(), out);
			}else{
        System.out.println();
        System.out.print("FreeMarker version ");
        System.out.println(Configuration.getVersionNumber());
        System.out.println();
        System.out.println("Copyright (c) 2003 The Visigoth Software Society.");
        System.out.println("All rights reserved.");
        System.out.println();
        System.out.println("This is Free software. Please read the
LICENSE.txt comes with ");
        System.out.println("the distribution for more details.");
        System.out.println();
        System.out.println("For more information and for updates visit
our WWW site:");
        System.out.println("http://freemarker.org/");
        System.out.println();
			}
    }

-Z

-Z

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.