Skip to content

Commit 035cdc5

Browse files
committed
feat: highlight a successful run as in legacy CLI, with green text and a checkmark
- from: Tested 590 dependencies for known issues, found 0 issues, 0 vulnerable paths. - to: ✔ Tested 590 dependencies for known issues, no vulnerable paths found.
1 parent a906715 commit 035cdc5

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

internal/presenters/funcs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ func getCliTemplateFuncMap(tmpl *template.Template) template.FuncMap {
252252
fnMap["box"] = func(s string) string { return boxStyle.Render(s) }
253253
fnMap["toUpperCase"] = strings.ToUpper
254254
fnMap["renderInSeverityColor"] = renderSeverityColor
255+
fnMap["renderGreen"] = renderGreen
255256
fnMap["bold"] = renderBold
256257
fnMap["tip"] = func(s string) string {
257258
return RenderTip(s + "\n")

internal/presenters/styles.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,9 @@ func renderSeverityColor(severity string) string {
3636
severityStyle := lipgloss.NewStyle().Foreground(style)
3737
return severityStyle.Render(severity)
3838
}
39+
40+
// renderGreen renders text in green.
41+
func renderGreen(str string) string {
42+
style := lipgloss.NewStyle().Foreground(lipgloss.Color("2"))
43+
return style.Render(str)
44+
}

internal/presenters/templates/unified_finding.tmpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@
114114
{{- $vulnerablePaths := len .Findings }}
115115

116116
{{- if gt .DependencyCount 0 -}}
117-
{{- printf "\nTested %d dependencies for known issues, found %d issues, %d vulnerable paths.\n" .DependencyCount $totalIssues $vulnerablePaths -}}
117+
{{- if eq $totalIssues 0 -}}
118+
{{- printf "\n✔ Tested %d dependencies for known issues, no vulnerable paths found.\n" .DependencyCount | renderGreen -}}
119+
{{- else -}}
120+
{{- printf "\nTested %d dependencies for known issues, found %d issues, %d vulnerable paths.\n" .DependencyCount $totalIssues $vulnerablePaths -}}
121+
{{- end -}}
118122
{{- end }}
119123

120124
{{- template "details" . }}

0 commit comments

Comments
 (0)