2023-08-30 12:12:24 -05:00
|
|
|
//go:build search
|
|
|
|
// +build search
|
|
|
|
|
|
|
|
package cli
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
|
|
|
"zotregistry.io/zot/pkg/cli/cmdflags"
|
|
|
|
)
|
|
|
|
|
2023-09-08 07:12:47 -05:00
|
|
|
func NewCVECommand(searchService SearchService) *cobra.Command {
|
2023-08-30 12:12:24 -05:00
|
|
|
cvesCmd := &cobra.Command{
|
2023-09-08 07:12:47 -05:00
|
|
|
Use: "cve [command]",
|
2023-08-30 12:12:24 -05:00
|
|
|
Short: "Lookup CVEs in images hosted on the zot registry",
|
|
|
|
Long: `List CVEs (Common Vulnerabilities and Exposures) of images hosted on the zot registry`,
|
2023-09-14 12:51:17 -05:00
|
|
|
RunE: ShowSuggestionsIfUnknownCommand,
|
2023-08-30 12:12:24 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
cvesCmd.SetUsageTemplate(cvesCmd.UsageTemplate() + usageFooter)
|
|
|
|
|
2023-09-08 07:12:47 -05:00
|
|
|
cvesCmd.PersistentFlags().String(cmdflags.URLFlag, "",
|
|
|
|
"Specify zot server URL if config-name is not mentioned")
|
|
|
|
cvesCmd.PersistentFlags().String(cmdflags.ConfigFlag, "",
|
|
|
|
"Specify the registry configuration to use for connection")
|
|
|
|
cvesCmd.PersistentFlags().StringP(cmdflags.UserFlag, "u", "",
|
|
|
|
`User Credentials of zot server in "username:password" format`)
|
2023-08-30 12:12:24 -05:00
|
|
|
cvesCmd.PersistentFlags().StringP(cmdflags.OutputFormatFlag, "f", "", "Specify output format [text/json/yaml]")
|
|
|
|
cvesCmd.PersistentFlags().Bool(cmdflags.VerboseFlag, false, "Show verbose output")
|
|
|
|
cvesCmd.PersistentFlags().Bool(cmdflags.DebugFlag, false, "Show debug output")
|
|
|
|
|
|
|
|
cvesCmd.AddCommand(NewCveForImageCommand(searchService))
|
|
|
|
cvesCmd.AddCommand(NewImagesByCVEIDCommand(searchService))
|
|
|
|
cvesCmd.AddCommand(NewFixedTagsCommand(searchService))
|
|
|
|
|
|
|
|
return cvesCmd
|
|
|
|
}
|