grype/cmd/db_delete.go
Alex Goodman 6fe9fc2c8c
update linter + fix whitespace (#443)
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
2021-10-06 09:49:42 -04:00

30 lines
597 B
Go

package cmd
import (
"fmt"
"github.com/anchore/grype/grype/db"
"github.com/spf13/cobra"
)
var dbDeleteCmd = &cobra.Command{
Use: "delete",
Short: "delete the vulnerability database",
Args: cobra.ExactArgs(0),
RunE: runDBDeleteCmd,
}
func init() {
dbCmd.AddCommand(dbDeleteCmd)
}
func runDBDeleteCmd(_ *cobra.Command, _ []string) error {
dbCurator := db.NewCurator(appConfig.DB.ToCuratorConfig())
if err := dbCurator.Delete(); err != nil {
return fmt.Errorf("unable to delete vulnerability database: %+v", err)
}
fmt.Println("Vulnerability database deleted")
return nil
}