aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
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
commitb044b8b0a13da161f885a9409ce543be43344bda (patch)
treeb82d58eda395d0c704d062625ab04149847a10bd /plugins
parenta06578f4fb1429a7f57e8ee3dc366fb5d89fef39 (diff)
downloadprosody-b044b8b0a13da161f885a9409ce543be43344bda.tar.gz
prosody-b044b8b0a13da161f885a9409ce543be43344bda.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.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