Mercurial > prosody-hg
comparison 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 |
| parents | ef2bd183f660 |
| children | 89d810a23ee0 |
comparison
equal
deleted
inserted
replaced
| 10794:4585fe53e21f | 10795:4c90f06f2247 |
|---|---|
| 328 | 328 |
| 329 -- Session environment -- | 329 -- Session environment -- |
| 330 -- Anything in def_env will be accessible within the session as a global variable | 330 -- Anything in def_env will be accessible within the session as a global variable |
| 331 | 331 |
| 332 --luacheck: ignore 212/self | 332 --luacheck: ignore 212/self |
| 333 local serialize_defaults = module:get_option("console_prettyprint_settings", { fatal = false, unquoted = true, maxdepth = 2}) | |
| 333 | 334 |
| 334 def_env.output = {}; | 335 def_env.output = {}; |
| 335 function def_env.output:configure(opts) | 336 function def_env.output:configure(opts) |
| 337 if type(opts) ~= "table" then | |
| 338 opts = { preset = opts }; | |
| 339 end | |
| 340 for k,v in pairs(serialize_defaults) do | |
| 341 if opts[k] == nil then | |
| 342 opts[k] = v; | |
| 343 end | |
| 344 end | |
| 336 self.session.serialize = serialization.new(opts); | 345 self.session.serialize = serialization.new(opts); |
| 337 end | 346 end |
| 338 | 347 |
| 339 def_env.server = {}; | 348 def_env.server = {}; |
| 340 | 349 |
