# HG changeset patch # User Matthew Wild # Date 1680790930 -3600 # Node ID 09656e2b4927c0c4d1c726474350ab0d8e1499e3 # Parent f370ccb15f055c97ccb661d0d39ac80d39b8fe71 mod_client_management: Improve table output Requires 1f89a2a9f532 and 1023c3faffac from Prosody. diff -r f370ccb15f05 -r 09656e2b4927 mod_client_management/mod_client_management.lua --- a/mod_client_management/mod_client_management.lua Thu Apr 06 15:21:09 2023 +0100 +++ b/mod_client_management/mod_client_management.lua Thu Apr 06 15:22:10 2023 +0100 @@ -389,22 +389,25 @@ end local colspec = { - { title = "Software", key = "software" }; - { title = "Last seen", key = "last_seen" }; - { title = "Authentication", key = "auth_methods" }; + { title = "Software", key = "software", width = "1p" }; + { title = "Last seen", key = "last_seen", width = 10 }; + { title = "Authentication", key = "auth_methods", width = "2p" }; }; local row = require "util.human.io".table(colspec, self.session.width); local print = self.session.print; print(row()); + print(string.rep("-", self.session.width)); for _, client in ipairs(clients) do print(row({ - software = client.user_agent.software; + id = client.id; + software = client.user_agent and client.user_agent.software; last_seen = os.date("%Y-%m-%d", client.last_seen); auth_methods = array.collect(it.keys(client.active)):sort(); })); end - print(("%d clients"):format(#clients)); + print(string.rep("-", self.session.width)); + return true, ("%d clients"):format(#clients); end end);