view core/src/luan/cmd_line.luan @ 479:1285c52ea9d4

add manual heading_options
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 11 May 2015 15:29:29 -0600
parents 2e79b47d02a2
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