From aa819862ebf8c75e533254f5af58efeb34917115 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Thu, 10 Jul 2025 13:02:11 +0200 Subject: [PATCH] fix: do not show empty zeroconf fields --- modules/zerogod/zerogod_show.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/zerogod/zerogod_show.go b/modules/zerogod/zerogod_show.go index 03abebbf..4c465d0d 100644 --- a/modules/zerogod/zerogod_show.go +++ b/modules/zerogod/zerogod_show.go @@ -61,15 +61,24 @@ func (mod *ZeroGod) show(filter string, withData bool) error { for _, field := range svc.Text { if field = str.Trim(field); len(field) > 0 { keyval := strings.SplitN(field, "=", 2) - rows = append(rows, []string{ - keyval[0], - keyval[1], - }) + key := str.Trim(keyval[0]) + val := str.Trim(keyval[1]) + + if key != "" || val != "" { + rows = append(rows, []string{ + key, + val, + }) + } } } - tui.Table(mod.Session.Events.Stdout, columns, rows) - fmt.Fprintf(mod.Session.Events.Stdout, "\n") + if len(rows) == 0 { + fmt.Fprintf(mod.Session.Events.Stdout, " %s\n", tui.Dim("no data")) + } else { + tui.Table(mod.Session.Events.Stdout, columns, rows) + fmt.Fprintf(mod.Session.Events.Stdout, "\n") + } } else { fmt.Fprintf(mod.Session.Events.Stdout, " %s\n", tui.Dim("no data"))