From 991553f6993bfc84db0b32c174995edb5159fbaf Mon Sep 17 00:00:00 2001 From: Eltrac Date: Tue, 11 Nov 2025 19:40:55 +0800 Subject: fix: remove extra line of interaction summary doesn't exist --- print.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/print.go b/print.go index 802df39..44ed428 100644 --- a/print.go +++ b/print.go @@ -31,16 +31,18 @@ func printHeader(data *statistics) { } func printUserInteractionSummary(data *statistics) { - printInstallDesc( + printed1 := printInstallDesc( data.Type == "formula", data.InstalledAsDependency, data.InstalledOnRequest, data.InstalledVersion, data.ReverseDependencies) - printRecentActivity( + printed2 := printRecentActivity( data.InstalledVersion, data.LastAccessTime) - fmt.Println() + if printed1 || printed2 { + fmt.Println() + } } func printMetadata(data *statistics) { @@ -76,14 +78,14 @@ func printInstallDesc( onRequest bool, version string, reverseDependencies []string, -) { +) (printed bool) { // formulae only if !isFormulae { - return + return false } if version == "" { - return + return false } else if onRequest { color.Blue("► You installed this package by running `brew install`.\n") } else if asDependency { @@ -91,13 +93,16 @@ func printInstallDesc( fmt.Printf("Used by: %s\n", strings.Join(reverseDependencies, ", ")) } + return true } // answers questions like "have I used this recently?" -func printRecentActivity(installedVersion string, atime time.Time) { +func printRecentActivity( + installedVersion string, + atime time.Time) (printed bool) { // skip if not installed if installedVersion == "" { - return + return false } // print usage info @@ -109,6 +114,7 @@ func printRecentActivity(installedVersion string, atime time.Time) { } else { color.Blue("► You haven't used this for %s.", humanReadableDuration) } + return true } // === #Section: Metadata# === // -- cgit v1.2.3