zotregistry.dev/zot@v1.4.4-0.20240314164342-eec277e14d20/pkg/cli/client/repo_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  const prefix = "Searching... "
    11  
    12  func NewRepoCommand(searchService SearchService) *cobra.Command {
    13  	repoCmd := &cobra.Command{
    14  		Use:   "repo [config-name]",
    15  		Short: "List all repositories",
    16  		Long:  `List all repositories`,
    17  		RunE:  ShowSuggestionsIfUnknownCommand,
    18  	}
    19  
    20  	repoCmd.SetUsageTemplate(repoCmd.UsageTemplate() + usageFooter)
    21  
    22  	repoCmd.PersistentFlags().String(URLFlag, "",
    23  		"Specify zot server URL if config-name is not mentioned")
    24  	repoCmd.PersistentFlags().String(ConfigFlag, "",
    25  		"Specify the registry configuration to use for connection")
    26  	repoCmd.PersistentFlags().StringP(UserFlag, "u", "",
    27  		`User Credentials of zot server in "username:password" format`)
    28  	repoCmd.PersistentFlags().Bool(DebugFlag, false, "Show debug output")
    29  
    30  	repoCmd.AddCommand(NewListReposCommand(searchService))
    31  
    32  	return repoCmd
    33  }