blob: ac46bbb2ddeaa3b1a2bf31038c61a616bee688aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
local objectSeal = assert(require("scriptlee").objectSeal)
local inn, out, log = io.stdin, io.stdout, io.stderr
local mod = {}
function mod.getExports()return{
--doWhatever = mod.doWhatever,
}end
function mod.printHelp()
out:write("\n"
.." TODO write this help page\n"
.."\n"
.." Options:\n"
.."\n")
end
function mod.parseArgs( this )
local positionalArgNr = 0
for iA=1, #_ENV.arg do
local arg = _ENV.arg[iA]
if false then
elseif arg == "--help" then
mod.printHelp() return -1
elseif not arg:find("^%-%-") then
positionalArgNr = positionalArgNr + 1
if false then
--elseif positionalArgNr == 1 then
-- this.whatever = arg
else
log:write("Unexpected arg: ".. arg .."\n")return -1
end
else
log:write("Unexpected arg: ".. arg .."\n")return -1
end
end
if not this.whatever then log:write("TODO write errmsg here\n")return -1 end
return 0
end
function mod.run( this )
log:write("[INFO ] TODO impl what the prog should do\n")
end
function mod.main()
local this = objectSeal{
whatever = false,
}
if mod.parseArgs(this) ~= 0 then os.exit(1) end
mod.run(this)
end
if debug.getinfo(3)then return mod.getExports()else mod.main()end
|