mirror of
https://github.com/anchore/grype
synced 2024-11-10 14:44:12 +00:00
6fe9fc2c8c
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
30 lines
597 B
Go
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
|
|
}
|