diff --git a/go.mod b/go.mod index 9dca3182696..1cb09cf680e 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,6 @@ require ( github.com/charmbracelet/glamour v0.7.0 github.com/charmbracelet/lipgloss v0.11.0 github.com/dghubble/trie v0.1.0 - github.com/fatih/color v1.15.0 github.com/gkampitakis/go-snaps v0.5.4 github.com/go-git/go-billy/v5 v5.5.0 github.com/go-git/go-git/v5 v5.12.0 @@ -78,7 +77,6 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/maruel/natural v1.1.1 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect diff --git a/go.sum b/go.sum index 04c69b9923d..0535ef96c19 100644 --- a/go.sum +++ b/go.sum @@ -87,8 +87,6 @@ github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/gkampitakis/ciinfo v0.3.0 h1:gWZlOC2+RYYttL0hBqcoQhM7h1qNkVqvRCV1fOvpAv8= github.com/gkampitakis/ciinfo v0.3.0/go.mod h1:1NIwaOcFChN4fa/B0hEBdAb6npDlFL8Bwx4dfRLRqAo= github.com/gkampitakis/go-diff v1.3.2 h1:Qyn0J9XJSDTgnsgHRdz9Zp24RaJeKMUHg2+PDZZdC4M= @@ -142,9 +140,6 @@ github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69 github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo= github.com/maruel/natural v1.1.1/go.mod h1:v+Rfd79xlw1AgVBjbO0BEQmptqb5HvL/k9GRHB7ZKEg= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= @@ -298,7 +293,6 @@ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/internal/output/vertical.go b/internal/output/vertical.go index 7e6604ce2f6..4b24c3d4612 100644 --- a/internal/output/vertical.go +++ b/internal/output/vertical.go @@ -6,8 +6,8 @@ import ( "strings" "unicode" - "github.com/fatih/color" "github.com/google/osv-scanner/pkg/models" + "github.com/jedib0t/go-pretty/v6/text" ) func PrintVerticalResults(vulnResult *models.VulnerabilityResults, outputWriter io.Writer) { @@ -29,8 +29,8 @@ func printVerticalHeader(result models.PackageSource, out io.Writer) { fmt.Fprintf( out, "%s: found %s %s with issues\n", - color.MagentaString("%s", result.Source.Path), - color.YellowString("%d", len(result.Packages)), + text.FgMagenta.Sprintf("%s", result.Source.Path), + text.FgYellow.Sprintf("%d", len(result.Packages)), Form(len(result.Packages), "package", "packages"), ) } @@ -42,7 +42,7 @@ func printVerticalVulnerabilities(result models.PackageSource, out io.Writer) { fmt.Fprintf( out, " %s\n", - color.GreenString("no known vulnerabilities found"), + text.FgGreen.Sprintf("no known vulnerabilities found"), ) return @@ -57,21 +57,21 @@ func printVerticalVulnerabilities(result models.PackageSource, out io.Writer) { fmt.Fprintf(out, " %s %s\n", - color.YellowString("%s@%s", pkg.Package.Name, pkg.Package.Version), - color.RedString("is affected by the following vulnerabilities:"), + text.FgYellow.Sprintf("%s@%s", pkg.Package.Name, pkg.Package.Version), + text.FgRed.Sprintf("is affected by the following vulnerabilities:"), ) for _, vulnerability := range pkg.Vulnerabilities { fmt.Fprintf(out, " %s %s\n", - color.CyanString("%s:", vulnerability.ID), + text.FgCyan.Sprintf("%s:", vulnerability.ID), describe(vulnerability), ) } } fmt.Fprintf(out, "\n %s\n", - color.RedString( + text.FgRed.Sprintf( "%d known %s found in %s", count, Form(count, "vulnerability", "vulnerabilities"), @@ -87,13 +87,13 @@ func printVerticalLicenseViolations(result models.PackageSource, out io.Writer) fmt.Fprintf( out, " %s\n", - color.GreenString("no license violations found"), + text.FgGreen.Sprintf("no license violations found"), ) return } - fmt.Fprintf(out, "\n %s\n", color.RedString("license violations found:")) + fmt.Fprintf(out, "\n %s\n", text.FgRed.Sprintf("license violations found:")) for _, pkg := range result.Packages { if len(pkg.LicenseViolations) == 0 { @@ -107,13 +107,13 @@ func printVerticalLicenseViolations(result models.PackageSource, out io.Writer) fmt.Fprintf(out, " %s (%s)\n", - color.YellowString("%s@%s", pkg.Package.Name, pkg.Package.Version), - color.CyanString(strings.Join(violations, ", ")), + text.FgYellow.Sprintf("%s@%s", pkg.Package.Name, pkg.Package.Version), + text.FgCyan.Sprintf(strings.Join(violations, ", ")), ) } fmt.Fprintf(out, "\n %s\n", - color.RedString( + text.FgRed.Sprintf( "%d license %s found in %s", count, Form(count, "violation", "violations"),