From 537023469320588e820a16701efc1747b0ff29b8 Mon Sep 17 00:00:00 2001 From: kevin olson Date: Wed, 20 Nov 2024 13:23:45 -0600 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20add=20prompt=20functionality=20?= =?UTF-8?q?to=20offline=20ipintel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cmd/offline/ipintel/ipintel.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/cmd/offline/ipintel/ipintel.go b/pkg/cmd/offline/ipintel/ipintel.go index 5207beb..9b336f3 100644 --- a/pkg/cmd/offline/ipintel/ipintel.go +++ b/pkg/cmd/offline/ipintel/ipintel.go @@ -5,6 +5,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/vulncheck-oss/cli/pkg/cache" + "github.com/vulncheck-oss/cli/pkg/cmd/offline/sync" "github.com/vulncheck-oss/cli/pkg/config" "github.com/vulncheck-oss/cli/pkg/search" "github.com/vulncheck-oss/cli/pkg/ui" @@ -45,6 +46,15 @@ func Command() *cobra.Command { return err } + indexAvailable, err := sync.EnsureIndexSync(indices, fmt.Sprintf("ipintel-%s", args[0]), false) + if err != nil { + return err + } + + if !indexAvailable { + return fmt.Errorf("index %s is required to proceed", fmt.Sprintf("ipintel-%s", args[0])) + } + index := indices.GetIndex(fmt.Sprintf("ipintel-%s", args[0])) if index == nil { From ebc773a5830283a0102181f9c858f65eb0985f0a Mon Sep 17 00:00:00 2001 From: kevin olson Date: Wed, 20 Nov 2024 13:32:25 -0600 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20need=20to=20refresh=20indice?= =?UTF-8?q?s=20after=20a=20download?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cmd/offline/ipintel/ipintel.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/cmd/offline/ipintel/ipintel.go b/pkg/cmd/offline/ipintel/ipintel.go index 9b336f3..27310c2 100644 --- a/pkg/cmd/offline/ipintel/ipintel.go +++ b/pkg/cmd/offline/ipintel/ipintel.go @@ -55,6 +55,12 @@ func Command() *cobra.Command { return fmt.Errorf("index %s is required to proceed", fmt.Sprintf("ipintel-%s", args[0])) } + indices, err = cache.Indices() + + if err != nil { + return err + } + index := indices.GetIndex(fmt.Sprintf("ipintel-%s", args[0])) if index == nil {