#!/usr/libexec/flua -- usage - chmod, then `pkg repositories | repos.flua` local ucl = require("ucl") local parser = ucl.parser() -- read from stdin local data = io.stdin:read("*all") -- try to convert to lua table local ok, err = parser:parse_string(data) if not ok then io.stderr:write("Error parsing UCL: " .. err .. "\n") os.exit(1) end -- fetch the root object data = parser:get_object() -- pretty-print the lua table as json print(ucl.to_format(data, "json"))