mirror of
https://github.com/anchore/grype
synced 2024-11-10 14:44:12 +00:00
add update check to entrypoint (#67)
This commit is contained in:
parent
695cc0f640
commit
fdbcc665a3
1 changed files with 13 additions and 0 deletions
13
cmd/root.go
13
cmd/root.go
|
@ -9,6 +9,7 @@ import (
|
||||||
"github.com/anchore/grype/grype/presenter"
|
"github.com/anchore/grype/grype/presenter"
|
||||||
"github.com/anchore/grype/internal"
|
"github.com/anchore/grype/internal"
|
||||||
"github.com/anchore/grype/internal/format"
|
"github.com/anchore/grype/internal/format"
|
||||||
|
"github.com/anchore/grype/internal/version"
|
||||||
"github.com/anchore/syft/syft/scope"
|
"github.com/anchore/syft/syft/scope"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
@ -78,6 +79,18 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func runDefaultCmd(_ *cobra.Command, args []string) error {
|
func runDefaultCmd(_ *cobra.Command, args []string) error {
|
||||||
|
if appConfig.CheckForAppUpdate {
|
||||||
|
isAvailable, newVersion, err := version.IsUpdateAvailable()
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf(err.Error())
|
||||||
|
}
|
||||||
|
if isAvailable {
|
||||||
|
log.Infof("New version of %s is available: %s", internal.ApplicationName, newVersion)
|
||||||
|
} else {
|
||||||
|
log.Debugf("No new %s update available", internal.ApplicationName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
userImageStr := args[0]
|
userImageStr := args[0]
|
||||||
|
|
||||||
provider, err := grype.LoadVulnerabilityDb(appConfig.Db.ToCuratorConfig(), appConfig.Db.AutoUpdate)
|
provider, err := grype.LoadVulnerabilityDb(appConfig.Db.ToCuratorConfig(), appConfig.Db.AutoUpdate)
|
||||||
|
|
Loading…
Reference in a new issue