diff options
author | Kim Alvefur <zash@zash.se> | 2020-05-02 20:32:43 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-05-02 20:32:43 +0200 |
commit | bfdff4488f72dd5e3595968b2fdb14d054c3977c (patch) | |
tree | b82d58eda395d0c704d062625ab04149847a10bd /plugins | |
parent | dc8d810f34ba55ec51a238a84c04673efb7fc7a3 (diff) | |
download | prosody-bfdff4488f72dd5e3595968b2fdb14d054c3977c.tar.gz prosody-bfdff4488f72dd5e3595968b2fdb14d054c3977c.zip |
mod_admin_telnet: Allow configuring pretty printing defaults
Mostly just to have the defaults merged so you can e.g.
output:configure({maxdepth=1})
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_admin_telnet.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index dcc19687..93a4587f 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -330,9 +330,18 @@ end -- Anything in def_env will be accessible within the session as a global variable --luacheck: ignore 212/self +local serialize_defaults = module:get_option("console_prettyprint_settings", { fatal = false, unquoted = true, maxdepth = 2}) def_env.output = {}; function def_env.output:configure(opts) + if type(opts) ~= "table" then + opts = { preset = opts }; + end + for k,v in pairs(serialize_defaults) do + if opts[k] == nil then + opts[k] = v; + end + end self.session.serialize = serialization.new(opts); end |