3 dkjson = require("dkjson")
4 cjdns = require("cjdns")
8 print("JSON interface to /etc/config/cjdns\n\nExamples: \
9 cjdrouteconf get > /tmp/etc/cjdroute.conf \
10 cat /tmp/etc/cjdroute.conf | cjdrouteconf set \
12 cjdrouteconf get | cjdroute")
15 if arg[1] == "get" then
16 local json = dkjson.encode(cjdns.uci.get(), { indent = true })
18 elseif arg[1] == "set" then
19 local json = io.stdin:read("*a")
20 local obj, pos, err = dkjson.decode(json, 1, nil)
25 print("dkjson: " .. err .. " (try cjdroute --cleanconf)")