aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_admin_telnet.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-05-02 20:32:43 +0200
committerKim Alvefur <zash@zash.se>2020-05-02 20:32:43 +0200
commitbfdff4488f72dd5e3595968b2fdb14d054c3977c (patch)
treeb82d58eda395d0c704d062625ab04149847a10bd /plugins/mod_admin_telnet.lua
parentdc8d810f34ba55ec51a238a84c04673efb7fc7a3 (diff)
downloadprosody-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/mod_admin_telnet.lua')
-rw-r--r--plugins/mod_admin_telnet.lua9
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