Debian Codegraph @

proj_mgmt/build_hide_cmd

raw
1 #!/usr/bin/env lua
2 -- -*- lua -*-
3
4 _G._DEBUG = false
5 local posix = require("posix")
6
7 require("strict")
8 require("string_utils")
9
10 local s_Is_dst = nil
11
12
13 function build_tStr(epoch, time_offset)
14 local myTime = epoch + time_offset
15 local tm = posix.localtime(myTime)
16 s_Is_dst = tm.is_dst
17 return string.format("%d-%02d-%02dT%02d:%02d",tm.year,tm.month,tm.day,
18 tm.hour, tm.min)
19 end
20
21 function main()
22 local concatTbl = table.concat
23 local idx = 1
24 local epoch = arg[idx]; idx = idx + 1
25 local name = arg[idx]; idx = idx + 1
26 local key = arg[idx]; idx = idx + 1
27 local time_offset = arg[idx]; idx = idx + 1
28 local other = arg[idx]; idx = idx + 1
29
30 epoch = math.floor(tonumber(epoch))
31 time_offset = tonumber(time_offset)
32 local tStr = build_tStr(epoch, time_offset)
33
34 local a = {}
35 a[#a+1] = "hide{"
36 a[#a+1] = "name=" .. "\"" .. name .. "\","
37 a[#a+1] = key .. "=\"" .. tStr .. "\","
38 a[#a+1] = other
39 a[#a+1] = "}"
40 print(concatTbl(a,""))
41
42 end
43
44
45 main()