in cmd/acr/tag.go [57:87]
func newTagListCmd(tagParams *tagParameters) *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Short: "List tags from a repository",
Long: newTagListCmdLongMessage,
RunE: func(_ *cobra.Command, _ []string) error {
registryName, err := tagParams.GetRegistryName()
if err != nil {
return err
}
loginURL := api.LoginURL(registryName)
// An acrClient is created to make the http requests to the registry.
acrClient, err := api.GetAcrCLIClientWithAuth(loginURL, tagParams.username, tagParams.password, tagParams.configs)
if err != nil {
return err
}
ctx := context.Background()
tagList, err := tag.ListTags(ctx, acrClient, tagParams.repoName)
if err != nil {
return err
}
fmt.Printf("Listing tags for the %q repository:\n", tagParams.repoName)
for _, tag := range tagList {
fmt.Printf("%s/%s:%s\n", loginURL, tagParams.repoName, *tag.Name)
}
return nil
},
}
return cmd
}