From 84b34b2221dc584c2963ac0b4a238f895935ed5a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 4 Mar 2021 20:43:53 -0500 Subject: [PATCH] feat: properly space report output --- plugins/common/common.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/common/common.go b/plugins/common/common.go index eab1018c0..47f3bbd13 100644 --- a/plugins/common/common.go +++ b/plugins/common/common.go @@ -378,11 +378,18 @@ func ReportSingleApp(reportType string, appName string, infoFlag string, infoFla return nil } + length := 0 flags := []string{} for key := range infoFlags { + if len(key) > length { + length = len(key) + } flags = append(flags, key) } sort.Strings(flags) + if length < 31 { + length = 31 + } if len(infoFlag) == 0 { LogInfo2Quiet(fmt.Sprintf("%s %v information", appName, reportType)) @@ -403,7 +410,7 @@ func ReportSingleApp(reportType string, appName string, infoFlag string, infoFla key = UcFirst(key) } - LogVerbose(fmt.Sprintf("%s%s", RightPad(fmt.Sprintf("%s:", key), 31, " "), v)) + LogVerbose(fmt.Sprintf("%s%s", RightPad(fmt.Sprintf("%s:", key), length, " "), v)) } return nil }