From 4528958c13a5047d1e9e30d266996c93175e3731 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Fri, 21 Nov 2025 08:38:15 +0800 Subject: fix: show recent activity only if there's a binary --- print.go | 13 ++++++++----- statistics.go | 3 +++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/print.go b/print.go index 44ed428..53b0f5c 100644 --- a/print.go +++ b/print.go @@ -39,7 +39,8 @@ func printUserInteractionSummary(data *statistics) { data.ReverseDependencies) printed2 := printRecentActivity( data.InstalledVersion, - data.LastAccessTime) + data.LastAccessTime, + data.BinaryExists) if printed1 || printed2 { fmt.Println() } @@ -98,10 +99,12 @@ func printInstallDesc( // answers questions like "have I used this recently?" func printRecentActivity( - installedVersion string, - atime time.Time) (printed bool) { - // skip if not installed - if installedVersion == "" { + installed string, + atime time.Time, + binary bool) (printed bool) { + + // skip if not installed or no related binary + if installed == "" || !binary { return false } diff --git a/statistics.go b/statistics.go index c83a25f..80017c9 100644 --- a/statistics.go +++ b/statistics.go @@ -15,6 +15,7 @@ type statistics struct { InstalledAsDependency bool; InstalledOnRequest bool; + BinaryExists bool; LastAccessTime time.Time; InstalledVersion string; @@ -63,8 +64,10 @@ func UnifyInfo(formula *FormulaInfo, cask *CaskInfo, pkgName string) (*statistic info, err := os.Stat(binPath) if err != nil { atime = time.Time{} // skip if no binary is found + statObject.BinaryExists = false } else { atime = time.Unix(info.Sys().(*syscall.Stat_t).Atimespec.Unix()) + statObject.BinaryExists = true } statObject.LastAccessTime = atime -- cgit v1.2.3