summaryrefslogtreecommitdiff
path: root/cmd/podman/images
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-12 07:01:10 -0400
committerGitHub <noreply@github.com>2020-10-12 07:01:10 -0400
commit212011f166d6f56421fcc5260def999e71156d32 (patch)
tree662725e76b8bc04a5ede4f8a3d40b375add1d334 /cmd/podman/images
parentdce30de594c6206659104a1208f4012a32a82bdc (diff)
parent66798e993a1d3c111f15a85242cac1427c39f53e (diff)
downloadpodman-212011f166d6f56421fcc5260def999e71156d32.tar.gz
podman-212011f166d6f56421fcc5260def999e71156d32.tar.bz2
podman-212011f166d6f56421fcc5260def999e71156d32.zip
Merge pull request #7836 from QiWang19/search-tags
Search repository tags using --list-tags
Diffstat (limited to 'cmd/podman/images')
-rw-r--r--cmd/podman/images/search.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go
index b8f590585..8edd776ce 100644
--- a/cmd/podman/images/search.go
+++ b/cmd/podman/images/search.go
@@ -85,6 +85,7 @@ func searchFlags(flags *pflag.FlagSet) {
flags.BoolVar(&searchOptions.NoTrunc, "no-trunc", false, "Do not truncate the output")
flags.StringVar(&searchOptions.Authfile, "authfile", auth.GetDefaultAuthFile(), "Path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override")
flags.BoolVar(&searchOptions.TLSVerifyCLI, "tls-verify", true, "Require HTTPS and verify certificates when contacting registries")
+ flags.BoolVar(&searchOptions.ListTags, "list-tags", false, "List the tags of the input registry")
}
// imageSearch implements the command for searching images.
@@ -101,6 +102,10 @@ func imageSearch(cmd *cobra.Command, args []string) error {
return errors.Errorf("Limit %d is outside the range of [1, 100]", searchOptions.Limit)
}
+ if searchOptions.ListTags && len(searchOptions.Filters) != 0 {
+ return errors.Errorf("filters are not applicable to list tags result")
+ }
+
// TLS verification in c/image is controlled via a `types.OptionalBool`
// which allows for distinguishing among set-true, set-false, unspecified
// which is important to implement a sane way of dealing with defaults of
@@ -119,12 +124,19 @@ func imageSearch(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
+
if len(searchReport) == 0 {
return nil
}
hdrs := report.Headers(entities.ImageSearchReport{}, nil)
row := "{{.Index}}\t{{.Name}}\t{{.Description}}\t{{.Stars}}\t{{.Official}}\t{{.Automated}}\n"
+ if searchOptions.ListTags {
+ if len(searchOptions.Filters) != 0 {
+ return errors.Errorf("filters are not applicable to list tags result")
+ }
+ row = "{{.Name}}\t{{.Tag}}\n"
+ }
if cmd.Flags().Changed("format") {
row = report.NormalizeFormat(searchOptions.Format)
}