Software /
code /
prosody
Diff
plugins/mod_admin_telnet.lua @ 10795:4c90f06f2247
mod_admin_telnet: Allow configuring pretty printing defaults
Mostly just to have the defaults merged so you can e.g.
output:configure({maxdepth=1})
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 02 May 2020 20:32:43 +0200 |
parent | 10792:ef2bd183f660 |
child | 10796:89d810a23ee0 |
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua Sat May 02 20:12:41 2020 +0200 +++ b/plugins/mod_admin_telnet.lua Sat May 02 20:32:43 2020 +0200 @@ -330,9 +330,18 @@ -- 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