2023-08-30 12:12:24 -05:00
|
|
|
//go:build search
|
|
|
|
// +build search
|
|
|
|
|
2023-09-15 17:17:01 -05:00
|
|
|
package client
|
2023-08-30 12:12:24 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
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-22 08:33:18 -05:00
|
|
|
cvesCmd.PersistentFlags().String(URLFlag, "",
|
2023-09-08 07:12:47 -05:00
|
|
|
"Specify zot server URL if config-name is not mentioned")
|
2023-09-22 08:33:18 -05:00
|
|
|
cvesCmd.PersistentFlags().String(ConfigFlag, "",
|
2023-09-08 07:12:47 -05:00
|
|
|
"Specify the registry configuration to use for connection")
|
2023-09-22 08:33:18 -05:00
|
|
|
cvesCmd.PersistentFlags().StringP(UserFlag, "u", "",
|
2023-09-08 07:12:47 -05:00
|
|
|
`User Credentials of zot server in "username:password" format`)
|
2023-09-22 08:33:18 -05:00
|
|
|
cvesCmd.PersistentFlags().StringP(OutputFormatFlag, "f", "", "Specify output format [text/json/yaml]")
|
|
|
|
cvesCmd.PersistentFlags().Bool(VerboseFlag, false, "Show verbose output")
|
|
|
|
cvesCmd.PersistentFlags().Bool(DebugFlag, false, "Show debug output")
|
2023-08-30 12:12:24 -05:00
|
|
|
|
|
|
|
cvesCmd.AddCommand(NewCveForImageCommand(searchService))
|
|
|
|
cvesCmd.AddCommand(NewImagesByCVEIDCommand(searchService))
|
|
|
|
cvesCmd.AddCommand(NewFixedTagsCommand(searchService))
|
2024-03-06 03:40:29 -05:00
|
|
|
cvesCmd.AddCommand(NewCVEDiffCommand(searchService))
|
2023-08-30 12:12:24 -05:00
|
|
|
|
|
|
|
return cvesCmd
|
|
|
|
}
|