diff options
| author | Eltrac <hi@guhub.cn> | 2025-11-11 19:37:03 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-11-11 19:37:03 +0800 |
| commit | 5f38e1e453d3f93c7a9bc613c27bdd7fd345d506 (patch) | |
| tree | 344ecf817e9b5163b47ca0711b584a640eb9e38a /print.go | |
| parent | eb5d4249c6db97bbbb52fd86c1451be50bb33398 (diff) | |
fix: extra space in version field when not installed
Diffstat (limited to 'print.go')
| -rw-r--r-- | print.go | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -45,7 +45,6 @@ func printUserInteractionSummary(data *statistics) { func printMetadata(data *statistics) { printVersionInfo( - data.Type, data.InstalledVersion, data.Outdated) printHomeAndLicense(data.Homepage, data.License) @@ -116,11 +115,10 @@ func printRecentActivity(installedVersion string, atime time.Time) { // prints badges like [Outdated] [Up to date] ... // used by printMetadata -func printVersionInfo(typ string, installedVersion string, outdated bool) { - var installBadge string - var installBadgeColor color.Attribute - +func printVersionInfo(installedVersion string, outdated bool) { if installedVersion != "" { + var installBadge string + var installBadgeColor color.Attribute if outdated { installBadge = "[Outdated]" installBadgeColor = color.FgYellow @@ -128,13 +126,12 @@ func printVersionInfo(typ string, installedVersion string, outdated bool) { installBadge = "[Up to date]" installBadgeColor = color.FgGreen } + fmt.Printf("📦 %s", installedVersion) + color.New(installBadgeColor).Printf(" %s\n", installBadge) } else { - installBadge = "[Not installed]" - installBadgeColor = color.FgRed + color.Red("📦 [Not installed]") } - fmt.Printf("📦 %s", installedVersion) - color.New(installBadgeColor).Printf(" %s\n", installBadge) } func printHomeAndLicense(homepage string, license string) { |
