2023-06-22 20:43:01 +03:00
|
|
|
//go:build search
|
|
|
|
// +build search
|
|
|
|
|
2023-09-16 01:17:01 +03:00
|
|
|
package client
|
2023-06-22 20:43:01 +03:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func NewSearchCommand(searchService SearchService) *cobra.Command {
|
2023-08-30 20:12:24 +03:00
|
|
|
searchCmd := &cobra.Command{
|
2023-09-14 20:51:17 +03:00
|
|
|
Use: "search [command]",
|
2023-06-22 20:43:01 +03:00
|
|
|
Short: "Search images and their tags",
|
2023-09-08 15:12:47 +03:00
|
|
|
Long: `Search repos or images`,
|
2023-09-14 20:51:17 +03:00
|
|
|
RunE: ShowSuggestionsIfUnknownCommand,
|
2023-06-22 20:43:01 +03:00
|
|
|
}
|
|
|
|
|
2023-08-30 20:12:24 +03:00
|
|
|
searchCmd.SetUsageTemplate(searchCmd.UsageTemplate() + usageFooter)
|
2023-06-22 20:43:01 +03:00
|
|
|
|
2023-09-22 16:33:18 +03:00
|
|
|
searchCmd.PersistentFlags().String(URLFlag, "",
|
2023-09-08 15:12:47 +03:00
|
|
|
"Specify zot server URL if config-name is not mentioned")
|
2023-09-22 16:33:18 +03:00
|
|
|
searchCmd.PersistentFlags().String(ConfigFlag, "",
|
2023-09-08 15:12:47 +03:00
|
|
|
"Specify the registry configuration to use for connection")
|
2023-09-22 16:33:18 +03:00
|
|
|
searchCmd.PersistentFlags().StringP(UserFlag, "u", "",
|
2023-09-08 15:12:47 +03:00
|
|
|
`User Credentials of zot server in "username:password" format`)
|
2023-09-22 16:33:18 +03:00
|
|
|
searchCmd.PersistentFlags().StringP(OutputFormatFlag, "f", "", "Specify output format [text/json/yaml]")
|
|
|
|
searchCmd.PersistentFlags().Bool(VerboseFlag, false, "Show verbose output")
|
|
|
|
searchCmd.PersistentFlags().Bool(DebugFlag, false, "Show debug output")
|
2023-09-08 15:12:47 +03:00
|
|
|
|
2023-08-30 20:12:24 +03:00
|
|
|
searchCmd.AddCommand(NewSearchQueryCommand(searchService))
|
|
|
|
searchCmd.AddCommand(NewSearchSubjectCommand(searchService))
|
|
|
|
|
|
|
|
return searchCmd
|
2023-06-22 20:43:01 +03:00
|
|
|
}
|