view core/src/luan/cmd_line.luan @ 462:2e79b47d02a2

remove all command line options; add add_extension boolean arg to scheme fns;
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 06 May 2015 16:54:20 -0600
parents b31d614343e8
children 8dcf9e12446b
line wrap: on
line source

local Luan = require "luan:Luan"
local ipairs = Luan.ipairs
local load_file = Luan.load_file
local try = Luan.try
local Table = require "luan:Table"
local Io = require "luan:Io"
local print = Io.print
local Debug = require "luan:Debug"


local args = {...}
if #args == 0 then
	print(Luan.VERSION)
	Debug.debug("> ")
else
	local file = args[1]
	Luan.arg = {}
	for j,v in ipairs(args) do
		Luan.arg[j-1] = v
	end
	try {
		function()
			local main_file = load_file(file,true)
			Debug.print_if_something( main_file( Table.unpack(Luan.arg) ) )
		end;
		catch = function(e)
--			java(); e.printStackTrace(); return
			Io.print_to(Io.stderr, e )
		end;
	}
end