Skip to content

Commit

Permalink
Merge pull request #163 from vulncheck-oss/ipintel-prompt
Browse files Browse the repository at this point in the history
✨ add prompt functionality to offline ipintel
  • Loading branch information
acidjazz authored Nov 20, 2024
2 parents d82e739 + ebc773a commit ee6665f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/cmd/offline/ipintel/ipintel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -45,6 +46,21 @@ 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]))
}

indices, err = cache.Indices()

if err != nil {
return err
}

index := indices.GetIndex(fmt.Sprintf("ipintel-%s", args[0]))

if index == nil {
Expand Down

0 comments on commit ee6665f

Please sign in to comment.