package cmd import ( "context" "github.com/spf13/cobra" "github.com/rs/zerolog/log" "os" ) var searchCmd = &cobra.Command{ Use: "search", Args: cobra.MinimumNArgs(1), Short: "Search CVEs.", Long: `Common Vulnerability Enumeration (CVE) search.`, Run: func(cmd *cobra.Command, args []string) { ctx := context.Background() // search for CVEs rows, err := getDb().CveSearch(ctx, getSearchQuery(args)) if err != nil { log.Error().Err(err).Msg("CveSearch") os.Exit(-1) } // write rows to stdout jsonEncode(rows) }, }