feat: colorized DELETED (#1944)

feat: colorize DELETED

Signed-off-by: Eric Bailey <eric@ericb.me>
This commit is contained in:
Eric Bailey 2025-02-18 22:30:02 -06:00 committed by GitHub
parent 82a2f7ed2f
commit 156a7576b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

2
go.mod
View File

@ -52,7 +52,7 @@ require (
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fatih/color v1.18.0
github.com/fujiwara/tfstate-lookup v1.5.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect

View File

@ -7,6 +7,8 @@ import (
"sort"
"strings"
"github.com/fatih/color"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/state"
)
@ -216,7 +218,11 @@ func (r *Run) diff(triggerCleanupEvent bool, detailedExitCode bool, c DiffConfig
names = append(names, fmt.Sprintf(" %s (%s) UPDATED", r.Name, r.Chart))
}
for _, r := range releasesToBeDeleted {
names = append(names, fmt.Sprintf(" %s (%s) DELETED", r.Name, r.Chart))
releaseToBeDeleted := fmt.Sprintf(" %s (%s) DELETED", r.Name, r.Chart)
if c.Color() {
releaseToBeDeleted = color.RedString(releaseToBeDeleted)
}
names = append(names, releaseToBeDeleted)
}
// Make the output deterministic for testing purpose
sort.Strings(names)