Last active 1765621367

repos.flua Raw
1#!/usr/libexec/flua
2
3-- usage - chmod, then `pkg repositories | repos.flua`
4
5local ucl = require("ucl")
6local parser = ucl.parser()
7
8-- read from stdin
9local data = io.stdin:read("*all")
10
11-- try to convert to lua table
12local ok, err = parser:parse_string(data)
13
14if not ok then
15 io.stderr:write("Error parsing UCL: " .. err .. "\n")
16 os.exit(1)
17end
18
19-- fetch the root object
20data = parser:get_object()
21
22-- pretty-print the lua table as json
23print(ucl.to_format(data, "json"))