gluon/package/gluon-announce/files/lib/gluon/announce/collect.lua
2015-04-08 21:16:55 +02:00

11 lines
310 B
Lua
Executable File

#!/usr/bin/lua
local announce = require 'gluon.announce'
local json = require 'luci.json'
local ltn12 = require 'luci.ltn12'
local announce_dir = '/lib/gluon/announce/' .. arg[1] .. '.d'
encoder = json.Encoder(announce.collect_dir(announce_dir))
ltn12.pump.all(encoder:source(), ltn12.sink.file(io.stdout))