diff --git a/cmd/grype/cli/commands/db_diff.go b/cmd/grype/cli/commands/db_diff.go index 526273cfd18..0072a4544aa 100644 --- a/cmd/grype/cli/commands/db_diff.go +++ b/cmd/grype/cli/commands/db_diff.go @@ -10,7 +10,6 @@ import ( "github.com/anchore/grype/cmd/grype/cli/options" "github.com/anchore/grype/grype/db/legacy/distribution" "github.com/anchore/grype/grype/differ" - "github.com/anchore/grype/internal" "github.com/anchore/grype/internal/bus" "github.com/anchore/grype/internal/log" ) @@ -30,7 +29,7 @@ func (d *dbDiffOptions) AddFlags(flags clio.FlagSet) { func DBDiff(app clio.Application) *cobra.Command { opts := &dbDiffOptions{ - Output: internal.TableOutputFormat, + Output: "table", DBOptions: *dbOptionsDefault(app.ID()), } diff --git a/cmd/grype/cli/commands/db_list.go b/cmd/grype/cli/commands/db_list.go index 49d46206679..30a1cfd7bec 100644 --- a/cmd/grype/cli/commands/db_list.go +++ b/cmd/grype/cli/commands/db_list.go @@ -9,7 +9,6 @@ import ( "github.com/anchore/clio" "github.com/anchore/grype/grype/db/legacy/distribution" - "github.com/anchore/grype/internal" ) type dbListOptions struct { @@ -25,7 +24,7 @@ func (d *dbListOptions) AddFlags(flags clio.FlagSet) { func DBList(app clio.Application) *cobra.Command { opts := &dbListOptions{ - Output: internal.TextOutputFormat, + Output: "text", DBOptions: *dbOptionsDefault(app.ID()), } @@ -59,7 +58,7 @@ func runDBList(opts *dbListOptions) error { } switch opts.Output { - case internal.TextOutputFormat: + case "text": // summarize each listing entry for the current DB schema for _, l := range available { fmt.Printf("Built: %s\n", l.Built) @@ -68,7 +67,7 @@ func runDBList(opts *dbListOptions) error { } fmt.Printf("%d databases available for schema %d\n", len(available), supportedSchema) - case internal.JSONOutputFormat: + case "json": // show entries for the current schema enc := json.NewEncoder(os.Stdout) enc.SetEscapeHTML(false) @@ -76,7 +75,7 @@ func runDBList(opts *dbListOptions) error { if err := enc.Encode(&available); err != nil { return fmt.Errorf("failed to db listing information: %+v", err) } - case internal.RawOutputFormat: + case "raw": // show the entire listing file enc := json.NewEncoder(os.Stdout) enc.SetEscapeHTML(false) diff --git a/cmd/grype/cli/commands/db_providers.go b/cmd/grype/cli/commands/db_providers.go index 3895b2fd4bc..59be716f630 100644 --- a/cmd/grype/cli/commands/db_providers.go +++ b/cmd/grype/cli/commands/db_providers.go @@ -54,7 +54,6 @@ func DBProviders(app clio.Application) *cobra.Command { } func runDBProviders(opts *dbProvidersOptions, app clio.Application) error { - metadataFileLocation, err := getMetadataFileLocation(app) if err != nil { return nil @@ -83,7 +82,6 @@ func runDBProviders(opts *dbProvidersOptions, app clio.Application) error { } func getMetadataFileLocation(app clio.Application) (*string, error) { - dbCurator, err := distribution.NewCurator(dbOptionsDefault(app.ID()).DB.ToCuratorConfig()) if err != nil { return nil, err diff --git a/cmd/grype/cli/commands/db_providers_test.go b/cmd/grype/cli/commands/db_providers_test.go index 1c217a496e2..734ff127f93 100644 --- a/cmd/grype/cli/commands/db_providers_test.go +++ b/cmd/grype/cli/commands/db_providers_test.go @@ -22,11 +22,11 @@ func TestGetDBProviders(t *testing.T) { fileLocation: "./test-fixtures", expectedProviders: dbProviders{ Providers: []dbProviderMetadata{ - dbProviderMetadata{ + { Name: "provider1", LastSuccessfulRun: "2024-10-16T01:33:16.844201Z", }, - dbProviderMetadata{ + { Name: "provider2", LastSuccessfulRun: "2024-10-16T01:32:43.516596Z", }, @@ -70,11 +70,11 @@ func TestDisplayDBProvidersTable(t *testing.T) { name: "display providers table", providers: dbProviders{ Providers: []dbProviderMetadata{ - dbProviderMetadata{ + { Name: "provider1", LastSuccessfulRun: "2024-10-16T01:33:16.844201Z", }, - dbProviderMetadata{ + { Name: "provider2", LastSuccessfulRun: "2024-10-16T01:32:43.516596Z", }, @@ -114,11 +114,11 @@ func TestDisplayDBProvidersJSON(t *testing.T) { name: "display providers table", providers: dbProviders{ Providers: []dbProviderMetadata{ - dbProviderMetadata{ + { Name: "provider1", LastSuccessfulRun: "2024-10-16T01:33:16.844201Z", }, - dbProviderMetadata{ + { Name: "provider2", LastSuccessfulRun: "2024-10-16T01:32:43.516596Z", },