Skip to content

Commit 3360873

Browse files
authored
feat: improve k8s diff summary messages (#576)
I found the summary not providing the right importance. I think this improves it a bit. Signed-off-by: Atze de Vries <atze.wiebe.de.vries@coop.no> Signed-off-by: Atze de Vries <atze.wiebe.de.vries@coop.no>
1 parent 22fdd8e commit 3360873

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

internal/kubernetes/kubernetes.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,16 @@ func DiffTemplates(chart HelmChart) error {
162162

163163
title := fmt.Sprintf("%s %s", filepath.Base(chart.path), chart.env)
164164
changes := strings.Count(out, "!")
165-
summary := fmt.Sprintf("found %d change(s)", changes)
166-
if changes > 0 {
167-
summary = fmt.Sprintf("found **%d** change(s)", changes)
165+
var summary string
166+
switch {
167+
case changes == 0:
168+
summary = "No changes"
169+
case changes == 1:
170+
summary = "1 change"
171+
case changes > 1:
172+
summary = fmt.Sprintf("%d changes", changes)
173+
default:
174+
summary = fmt.Sprintf("Could not count changes, found %d", changes)
168175
}
169176
md, err := diffMarkdownTemplate(title, summary, out, 64000)
170177
if err != nil {

0 commit comments

Comments
 (0)