"podman images" --sort option seems awfully forgiving
while "man podman-images" states that "created" is the default key for sorting images, it apparently does not point out that *any* invalid sort criteria you specify will use the sort criteria of "created". i noticed this when i mistyped the sort criteria and, to my surprise, it worked fine, which now makes sense given the code in images.go: func sortImagesOutput(sortBy string, imagesOutput imagesSorted) imagesSorted { switch sortBy { case "id": sort.Sort(imagesSortedID{imagesOutput}) case "size": sort.Sort(imagesSortedSize{imagesOutput}) case "tag": sort.Sort(imagesSortedTag{imagesOutput}) case "repository": sort.Sort(imagesSortedRepository{imagesOutput}) default: // default is created time sort.Sort(imagesSortedCreated{imagesOutput}) is that the intended behaviour? it caught me a bit off-guard. rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ========================================================================
On 2020-01-24 07:07, Robert P. J. Day wrote:
while "man podman-images" states that "created" is the default key for sorting images, it apparently does not point out that *any* invalid sort criteria you specify will use the sort criteria of "created".
i noticed this when i mistyped the sort criteria and, to my surprise, it worked fine, which now makes sense given the code in images.go:
func sortImagesOutput(sortBy string, imagesOutput imagesSorted) imagesSorted { switch sortBy { case "id": sort.Sort(imagesSortedID{imagesOutput}) case "size": sort.Sort(imagesSortedSize{imagesOutput}) case "tag": sort.Sort(imagesSortedTag{imagesOutput}) case "repository": sort.Sort(imagesSortedRepository{imagesOutput}) default: // default is created time sort.Sort(imagesSortedCreated{imagesOutput})
is that the intended behaviour? it caught me a bit off-guard.
rday
This sounds like a bug, though I'd need to verify what the Docker behavior is to be certain. We try to match their CLI interface whenever we can, so I'd like to be consistent here as well. Thanks, Matt Heon
--
======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca
Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ======================================================================== _______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
On 1/24/20 1:07 PM, Robert P. J. Day wrote:
while "man podman-images" states that "created" is the default key for sorting images, it apparently does not point out that *any* invalid sort criteria you specify will use the sort criteria of "created".
i noticed this when i mistyped the sort criteria and, to my surprise, it worked fine, which now makes sense given the code in images.go:
func sortImagesOutput(sortBy string, imagesOutput imagesSorted) imagesSorted { switch sortBy { case "id": sort.Sort(imagesSortedID{imagesOutput}) case "size": sort.Sort(imagesSortedSize{imagesOutput}) case "tag": sort.Sort(imagesSortedTag{imagesOutput}) case "repository": sort.Sort(imagesSortedRepository{imagesOutput}) default: // default is created time sort.Sort(imagesSortedCreated{imagesOutput})
is that the intended behaviour? it caught me a bit off-guard.
rday
No I would think not. It should probably throw an error.
On 1/24/20 1:07 PM, Robert P. J. Day wrote:
while "man podman-images" states that "created" is the default key for sorting images, it apparently does not point out that *any* invalid sort criteria you specify will use the sort criteria of "created".
i noticed this when i mistyped the sort criteria and, to my surprise, it worked fine, which now makes sense given the code in images.go:
func sortImagesOutput(sortBy string, imagesOutput imagesSorted) imagesSorted { switch sortBy { case "id": sort.Sort(imagesSortedID{imagesOutput}) case "size": sort.Sort(imagesSortedSize{imagesOutput}) case "tag": sort.Sort(imagesSortedTag{imagesOutput}) case "repository": sort.Sort(imagesSortedRepository{imagesOutput}) default: // default is created time sort.Sort(imagesSortedCreated{imagesOutput})
is that the intended behaviour? it caught me a bit off-guard.
rday
participants (3)
-
Daniel Walsh -
Matt Heon -
Robert P. J. Day