# HG changeset patch # User Kim Alvefur # Date 1588444363 -7200 # Node ID 4c90f06f22475acfa2c8cbc8483659977a1567b0 # Parent 4585fe53e21fb6d383048de82357104530c92118 mod_admin_telnet: Allow configuring pretty printing defaults Mostly just to have the defaults merged so you can e.g. output:configure({maxdepth=1}) diff -r 4585fe53e21f -r 4c90f06f2247 plugins/mod_admin_telnet.lua --- 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