diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-01-28 15:05:30 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-28 15:05:30 -0800 |
commit | 50eaf6de92b4e9feef9adba41e2b14f3cf3a0809 (patch) | |
tree | f92211c1696e68180aa7d7d207c596090c80d9c5 /cmd/podman/images.go | |
parent | 66bb873390badc4ad88620d211de09b4668d1cd5 (diff) | |
parent | 38d2ef0cbd32a68a6d2c74b35d75fd9b14a3867a (diff) | |
download | podman-50eaf6de92b4e9feef9adba41e2b14f3cf3a0809.tar.gz podman-50eaf6de92b4e9feef9adba41e2b14f3cf3a0809.tar.bz2 podman-50eaf6de92b4e9feef9adba41e2b14f3cf3a0809.zip |
Merge pull request #4973 from rhatdan/sort
Throw error on invalid sort value
Diffstat (limited to 'cmd/podman/images.go')
-rw-r--r-- | cmd/podman/images.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd/podman/images.go b/cmd/podman/images.go index 75cdd3465..115f30d9b 100644 --- a/cmd/podman/images.go +++ b/cmd/podman/images.go @@ -159,6 +159,21 @@ func imagesCmd(c *cliconfig.ImagesValues) error { filters = append(filters, fmt.Sprintf("reference=%s", image)) } + var sortValues = map[string]bool{ + "created": true, + "id": true, + "repository": true, + "size": true, + "tag": true, + } + if !sortValues[c.Sort] { + keys := make([]string, 0, len(sortValues)) + for k := range sortValues { + keys = append(keys, k) + } + return errors.Errorf("invalid sort value %q, required values: %s", c.Sort, strings.Join(keys, ", ")) + } + opts := imagesOptions{ quiet: c.Quiet, noHeading: c.Noheading, |