summaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm/fuzzy_stat.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-05-31 17:20:12 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-05-31 17:20:12 +0100
commit98763319d1169ede18cb0470672cc7acb8f0d679 (patch)
tree2a844716829df745102c7c5abdc074253f6d873b /lualib/rspamadm/fuzzy_stat.lua
parentc0262caefb3cdc6c3792bfe871e64333aa89783d (diff)
downloadrspamd-98763319d1169ede18cb0470672cc7acb8f0d679.tar.gz
rspamd-98763319d1169ede18cb0470672cc7acb8f0d679.zip
[Project] Deprecate and remove getopt library
Diffstat (limited to 'lualib/rspamadm/fuzzy_stat.lua')
-rw-r--r--lualib/rspamadm/fuzzy_stat.lua25
1 files changed, 22 insertions, 3 deletions
diff --git a/lualib/rspamadm/fuzzy_stat.lua b/lualib/rspamadm/fuzzy_stat.lua
index 20945bd4a..45e13bb60 100644
--- a/lualib/rspamadm/fuzzy_stat.lua
+++ b/lualib/rspamadm/fuzzy_stat.lua
@@ -1,6 +1,27 @@
local util = require "rspamd_util"
local opts = {}
+local argparse = require "argparse"
+local parser = argparse()
+ :name "rspamadm confighelp"
+ :description "Shows help for the specified configuration options"
+ :help_description_margin(32)
+parser:flag "--no-ips"
+ :description "No IPs stats"
+parser:flag "--no-keys"
+ :description "No keys stats"
+parser:flag "--short"
+ :description "Short output mode"
+parser:flag "-n --number"
+ :description "Disable numbers humanization"
+parser:option "-s --sort"
+ :description "Sort order"
+ :convert {
+ matched = "matched",
+ errors = "errors",
+ ip = "ip"
+ }
+
local function add_data(target, src)
for k,v in pairs(src) do
if k ~= 'ips' then
@@ -143,13 +164,11 @@ local function print_result(r)
return print_num(r)
end
-local getopt = require "getopt"
-
return function(args, res)
local res_ips = {}
local res_databases = {}
local wrk = res['workers']
- opts = getopt.getopt(args, '')
+ opts = parser:parse(args)
if wrk then
for _,pr in pairs(wrk) do