6
6
"strings"
7
7
"unicode"
8
8
9
- "github.com/fatih/color"
10
9
"github.com/google/osv-scanner/pkg/models"
10
+ "github.com/jedib0t/go-pretty/v6/text"
11
11
)
12
12
13
13
func PrintVerticalResults (vulnResult * models.VulnerabilityResults , outputWriter io.Writer ) {
@@ -29,8 +29,8 @@ func printVerticalHeader(result models.PackageSource, out io.Writer) {
29
29
fmt .Fprintf (
30
30
out ,
31
31
"%s: found %s %s with issues\n " ,
32
- color . MagentaString ("%s" , result .Source .Path ),
33
- color . YellowString ("%d" , len (result .Packages )),
32
+ text . FgMagenta . Sprintf ("%s" , result .Source .Path ),
33
+ text . FgYellow . Sprintf ("%d" , len (result .Packages )),
34
34
Form (len (result .Packages ), "package" , "packages" ),
35
35
)
36
36
}
@@ -42,7 +42,7 @@ func printVerticalVulnerabilities(result models.PackageSource, out io.Writer) {
42
42
fmt .Fprintf (
43
43
out ,
44
44
" %s\n " ,
45
- color . GreenString ("no known vulnerabilities found" ),
45
+ text . FgGreen . Sprintf ("no known vulnerabilities found" ),
46
46
)
47
47
48
48
return
@@ -57,21 +57,21 @@ func printVerticalVulnerabilities(result models.PackageSource, out io.Writer) {
57
57
58
58
fmt .Fprintf (out ,
59
59
" %s %s\n " ,
60
- color . YellowString ("%s@%s" , pkg .Package .Name , pkg .Package .Version ),
61
- color . RedString ("is affected by the following vulnerabilities:" ),
60
+ text . FgYellow . Sprintf ("%s@%s" , pkg .Package .Name , pkg .Package .Version ),
61
+ text . FgRed . Sprintf ("is affected by the following vulnerabilities:" ),
62
62
)
63
63
64
64
for _ , vulnerability := range pkg .Vulnerabilities {
65
65
fmt .Fprintf (out ,
66
66
" %s %s\n " ,
67
- color . CyanString ("%s:" , vulnerability .ID ),
67
+ text . FgCyan . Sprintf ("%s:" , vulnerability .ID ),
68
68
describe (vulnerability ),
69
69
)
70
70
}
71
71
}
72
72
73
73
fmt .Fprintf (out , "\n %s\n " ,
74
- color . RedString (
74
+ text . FgRed . Sprintf (
75
75
"%d known %s found in %s" ,
76
76
count ,
77
77
Form (count , "vulnerability" , "vulnerabilities" ),
@@ -87,13 +87,13 @@ func printVerticalLicenseViolations(result models.PackageSource, out io.Writer)
87
87
fmt .Fprintf (
88
88
out ,
89
89
" %s\n " ,
90
- color . GreenString ("no license violations found" ),
90
+ text . FgGreen . Sprintf ("no license violations found" ),
91
91
)
92
92
93
93
return
94
94
}
95
95
96
- fmt .Fprintf (out , "\n %s\n " , color . RedString ("license violations found:" ))
96
+ fmt .Fprintf (out , "\n %s\n " , text . FgRed . Sprintf ("license violations found:" ))
97
97
98
98
for _ , pkg := range result .Packages {
99
99
if len (pkg .LicenseViolations ) == 0 {
@@ -107,13 +107,13 @@ func printVerticalLicenseViolations(result models.PackageSource, out io.Writer)
107
107
108
108
fmt .Fprintf (out ,
109
109
" %s (%s)\n " ,
110
- color . YellowString ("%s@%s" , pkg .Package .Name , pkg .Package .Version ),
111
- color . CyanString (strings .Join (violations , ", " )),
110
+ text . FgYellow . Sprintf ("%s@%s" , pkg .Package .Name , pkg .Package .Version ),
111
+ text . FgCyan . Sprintf (strings .Join (violations , ", " )),
112
112
)
113
113
}
114
114
115
115
fmt .Fprintf (out , "\n %s\n " ,
116
- color . RedString (
116
+ text . FgRed . Sprintf (
117
117
"%d license %s found in %s" ,
118
118
count ,
119
119
Form (count , "violation" , "violations" ),
0 commit comments