From 156a7576b50095e4689634dcaa46d3417e476bb0 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 18 Feb 2025 22:30:02 -0600 Subject: [PATCH] feat: colorized DELETED (#1944) feat: colorize DELETED Signed-off-by: Eric Bailey --- go.mod | 2 +- pkg/app/run.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 577e17aa..42f5a792 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/pkg/app/run.go b/pkg/app/run.go index e29fce2a..57484de0 100644 --- a/pkg/app/run.go +++ b/pkg/app/run.go @@ -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)