36 lines
1 KiB
Lua
Executable file
36 lines
1 KiB
Lua
Executable file
#!/usr/bin/env lua
|
|
|
|
require "luarocks.loader"
|
|
|
|
local opts, port = {foreground = true}
|
|
|
|
for n,v in ipairs(arg) do
|
|
if(v == "--port") then
|
|
port = arg[n+1]
|
|
elseif(v == "--fennel") then
|
|
opts.fennel = true
|
|
elseif(v == "--debug") then
|
|
opts.debug = true
|
|
elseif(v == "--empty-sandbox") then
|
|
opts.sandbox = {}
|
|
elseif(v == "--version" or v == "--help") then
|
|
print("jeejah 0.2.0\n")
|
|
print("Options:")
|
|
print(" --fennel Start a Fennel server instead of Lua")
|
|
print(" --port Port on which to listen")
|
|
print(" --debug Print verbose debugging information")
|
|
os.exit(0)
|
|
end
|
|
end
|
|
|
|
local root_dir = debug.getinfo(1).source:sub(2, -(1+#"bin/jeejah"))
|
|
local search_parent = string.format("%s?.lua;%s", root_dir, package.path)
|
|
if(package.searchpath) then
|
|
local jeejah = dofile(package.searchpath("jeejah", search_parent))
|
|
jeejah.start(port, opts)
|
|
else -- 5.1
|
|
if root_dir == "" then root_dir = "." end
|
|
local jeejah = dofile(root_dir .. "/jeejah.lua")
|
|
jeejah.start(port, opts)
|
|
end
|