This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail.git
The following commit(s) were added to refs/heads/master by this push:
new 30e9a65 Allow for JSON string input
30e9a65 is described below
commit 30e9a658f9210e36745b79ba14aefb5bcfd6602b
Author: Sebb <[email protected]>
AuthorDate: Tue Oct 12 16:48:37 2021 +0100
Allow for JSON string input
---
test/stats_cli.lua | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/test/stats_cli.lua b/test/stats_cli.lua
index fe2474d..b4c4069 100755
--- a/test/stats_cli.lua
+++ b/test/stats_cli.lua
@@ -90,7 +90,18 @@ local function test(args)
end
local argc = #arg
-if argc % 2 == 0
+if argc == 0 -- assume reading lines of JSON strings
+then
+ for line in io.lines()
+ do
+ jzon = JSON.decode(line)
+ jzon.quick = true -- disable most queries
+ _CACHE.args = jzon
+ _CACHE.status = handle(r)
+ print(JSON.encode(_CACHE))
+ io.flush()
+ end
+elseif argc % 2 == 0
then
local data = {}
for i = 1,argc,2 do
@@ -102,6 +113,13 @@ then
else
print(JSON.encode(res))
end
+elseif argc == 1 -- assume JSON string
+then
+ jzon = JSON.decode(arg[1])
+ jzon.quick = true -- disable most queries
+ _CACHE.args = jzon
+ _CACHE.status = handle(r)
+ print(JSON.encode(_CACHE))
else
print("Need even arg count")
os.exit(1)