# HG changeset patch # User Matthew Wild # Date 1680870334 -3600 # Node ID 11b37063d80a77e4346d5460de57e42533bf655c # Parent 18fd615c2733202322742c4f55b6ceba6164eafb mod_audit: Add some control over output columns via command-line flags diff -r 18fd615c2733 -r 11b37063d80a mod_audit/mod_audit.lua --- a/mod_audit/mod_audit.lua Fri Apr 07 13:10:43 2023 +0100 +++ b/mod_audit/mod_audit.lua Fri Apr 07 13:25:34 2023 +0100 @@ -155,7 +155,7 @@ { title = "Event", key = "event_type", width = "2p" }; }; - if not arg.global then + if arg.show_user ~= false and (not arg.global or arg.show_user) then table.insert(colspec, { title = "User", key = "username", width = "2p", mapper = function (user) @@ -165,17 +165,16 @@ end end; }); - - if attach_ips then - table.insert(colspec, { - title = "IP", key = "ip", width = "2p"; - }); - end - if attach_location then - table.insert(colspec, { - title = "Location", key = "country", width = 2; - }); - end + end + if arg.show_ip ~= false and (not arg.global and attach_ips or arg.show_ip) then + table.insert(colspec, { + title = "IP", key = "ip", width = "2p"; + }); + end + if arg.show_location ~= false and (not arg.global and attach_location or arg.show_location) then + table.insert(colspec, { + title = "Location", key = "country", width = 2; + }); end local row, width = require "util.human.io".table(colspec);