diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-29 12:53:28 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-29 12:53:28 +0000 |
commit | 947c392559a52be9551854af16f90abf590cd3cb (patch) | |
tree | c3e213cf9fba0b75f655182628c11aa3861926d8 /src/rspamadm/confighelp.c | |
parent | 39814844b54aa2dfae7876e8fa01df1aeb1f4d2e (diff) | |
download | rspamd-947c392559a52be9551854af16f90abf590cd3cb.tar.gz rspamd-947c392559a52be9551854af16f90abf590cd3cb.zip |
Add lua pretty formatter for confighelp
Diffstat (limited to 'src/rspamadm/confighelp.c')
-rw-r--r-- | src/rspamadm/confighelp.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/rspamadm/confighelp.c b/src/rspamadm/confighelp.c index 462d6ff50..870676e9f 100644 --- a/src/rspamadm/confighelp.c +++ b/src/rspamadm/confighelp.c @@ -29,6 +29,7 @@ #include "cfg_rcl.h" #include "rspamd.h" #include "lua/lua_common.h" +#include "confighelp.lua.h" static gboolean json = FALSE; static gboolean compact = FALSE; @@ -81,7 +82,8 @@ rspamadm_confighelp_help (gboolean full_help) } static void -rspamadm_confighelp_show (const char *key, const ucl_object_t *obj) +rspamadm_confighelp_show (struct rspamd_config *cfg, gint argc, gchar **argv, + const char *key, const ucl_object_t *obj) { rspamd_fstring_t *out; @@ -103,7 +105,14 @@ rspamadm_confighelp_show (const char *key, const ucl_object_t *obj) rspamd_fprintf (stdout, "Showing help for all options:\n"); } - rspamd_ucl_emit_fstring (obj, UCL_EMIT_CONFIG, &out); + rspamadm_execute_lua_ucl_subr (cfg->lua_state, + argc, + argv, + obj, + rspamadm_script_confighelp); + + rspamd_fstring_free (out); + return; } rspamd_fprintf (stdout, "%V", out); @@ -245,7 +254,7 @@ rspamadm_confighelp (gint argc, gchar **argv) } if (doc_obj != NULL) { - rspamadm_confighelp_show (argv[i], doc_obj); + rspamadm_confighelp_show (cfg, argc, argv, argv[i], doc_obj); if (keyword) { ucl_object_unref ((ucl_object_t *)doc_obj); @@ -265,7 +274,7 @@ rspamadm_confighelp (gint argc, gchar **argv) } else { /* Show all documentation strings */ - rspamadm_confighelp_show (NULL, cfg->doc_strings); + rspamadm_confighelp_show (cfg, argc, argv, NULL, cfg->doc_strings); } rspamd_config_free (cfg); |