summaryrefslogtreecommitdiffstats
path: root/src/rspamadm
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-22 23:08:06 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-22 23:08:06 +0100
commitd34b7a2f737214e517f1c7945d009bc8282a9d70 (patch)
tree3f4817e5044f36b65ec25d6509dbe4a6256fd907 /src/rspamadm
parentce6490f17f7f3c9cc865a46e3df78f1d3d11a996 (diff)
downloadrspamd-d34b7a2f737214e517f1c7945d009bc8282a9d70.tar.gz
rspamd-d34b7a2f737214e517f1c7945d009bc8282a9d70.zip
[Minor] Improve confighelp output
Diffstat (limited to 'src/rspamadm')
-rw-r--r--src/rspamadm/confighelp.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/rspamadm/confighelp.lua b/src/rspamadm/confighelp.lua
index 91da3177d..e95dd0b36 100644
--- a/src/rspamadm/confighelp.lua
+++ b/src/rspamadm/confighelp.lua
@@ -64,16 +64,11 @@ local function print_help(key, value, tabs)
if not opts['short'] then
if value['data'] then
- print(string.format('%s\tDescription: %s', tabs, value['data']))
- end
- if not opts['no-examples'] and value['example'] then
- print(string.format('%s\tExample: %s', tabs, value['example']))
+ local nv = string.match(value['data'], '^#%s*(.*)%s*$') or value.data
+ print(string.format('%s\tDescription: %s', tabs, nv))
end
if value['type'] then
print(string.format('%s\tType: %s', tabs, value['type']))
- if value['type'] == 'object' then
- print('')
- end
end
if type(value['required']) == 'boolean' then
if value['required'] then
@@ -87,6 +82,13 @@ local function print_help(key, value, tabs)
if value['default'] then
print(string.format('%s\tDefault: %s', tabs, value['default']))
end
+ if not opts['no-examples'] and value['example'] then
+ local nv = string.match(value['example'], '^%s*(.*[^%s])%s*$') or value.example
+ print(string.format('%s\tExample:\n%s', tabs, nv))
+ end
+ if value.type and value.type == 'object' then
+ print('')
+ end
end
local sorted = sort_values(value)