package org.muellerware.jsml;

import org.mozilla.javascript.Context;
import org.mozilla.javascript.ContextFactory;

//-------------------------------------------------------------------
public class Main {

	//---------------------------------------------------------------
	static private void error(String message) {
		System.err.println(message);
		System.exit(1);
	}
	
	//---------------------------------------------------------------
	static public void main(String[] args) {
		
		// check for at least a script name argument
		if (args.length <= 0) error("gimme at least the file name of a script to run, jeez!");

		// enter context
		ContextFactory contextFactory = new ContextFactory();
		Context        context        = contextFactory.enterContext();

		// load the argument as a module
		ModuleLoader.load(context, args[0]);
		
		// exit context
		Context.exit();
	}
}
