zotregistry.dev/zot@v1.4.4-0.20240314164342-eec277e14d20/pkg/cli/client/search_cmd.go (about) 1 //go:build search 2 // +build search 3 4 package client 5 6 import ( 7 "github.com/spf13/cobra" 8 ) 9 10 func NewSearchCommand(searchService SearchService) *cobra.Command { 11 searchCmd := &cobra.Command{ 12 Use: "search [command]", 13 Short: "Search images and their tags", 14 Long: `Search repos or images`, 15 RunE: ShowSuggestionsIfUnknownCommand, 16 } 17 18 searchCmd.SetUsageTemplate(searchCmd.UsageTemplate() + usageFooter) 19 20 searchCmd.PersistentFlags().String(URLFlag, "", 21 "Specify zot server URL if config-name is not mentioned") 22 searchCmd.PersistentFlags().String(ConfigFlag, "", 23 "Specify the registry configuration to use for connection") 24 searchCmd.PersistentFlags().StringP(UserFlag, "u", "", 25 `User Credentials of zot server in "username:password" format`) 26 searchCmd.PersistentFlags().StringP(OutputFormatFlag, "f", "", "Specify output format [text/json/yaml]") 27 searchCmd.PersistentFlags().Bool(VerboseFlag, false, "Show verbose output") 28 searchCmd.PersistentFlags().Bool(DebugFlag, false, "Show debug output") 29 30 searchCmd.AddCommand(NewSearchQueryCommand(searchService)) 31 searchCmd.AddCommand(NewSearchSubjectCommand(searchService)) 32 33 return searchCmd 34 }