diff options
Diffstat (limited to 'make')
-rw-r--r-- | make/bootstrap.lua | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/make/bootstrap.lua b/make/bootstrap.lua index cf908b67..77f1a4d0 100644 --- a/make/bootstrap.lua +++ b/make/bootstrap.lua @@ -1,39 +1,25 @@ -local main
local i = 1
-while arg[i] do
+while true do
if arg[i] == '-E' then
elseif arg[i] == '-e' then
i = i + 1
local expr = assert(arg[i], "'-e' needs argument")
assert(load(expr, "=(command line)"))()
- -- TODO
- return
- elseif not main and arg[i]:sub(1, 1) ~= '-' then
- main = i
+ else
+ break
end
+ i = i + 1
end
-if main then
- for i = -1, -999, -1 do
- if not arg[i] then
- for j = i + 1, -1 do
- arg[j - main + 1] = arg[j]
- end
- break
- end
- end
- for j = 1, #arg do
- arg[j - main] = arg[j]
- end
- for j = #arg - main + 1, #arg do
- arg[j] = nil
- end
-else
- arg[0] = 'main.lua'
+if arg[i] == nil then
+ return
end
-for k, v in pairs(arg) do
- print(k, v)
+for j = -1, #arg do
+ arg[j - i] = arg[j]
+end
+for j = #arg - i + 1, #arg do
+ arg[j] = nil
end
local root; do
@@ -52,5 +38,4 @@ package.path = table.concat({ root .. "/script/?.lua",
root .. "/script/?/init.lua",
}, ";")
-
assert(loadfile(arg[0]))(table.unpack(arg))
|