diff options
author | Brent Baude <bbaude@redhat.com> | 2020-04-16 08:39:34 -0500 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2020-04-16 12:04:46 -0500 |
commit | ba430bfe5ef65d5aa5ffa1fef0087da76aafcc35 (patch) | |
tree | 3554a8bc2a5add5feee1d008d594665f82279fb3 /pkg/ps | |
parent | 8857ba20a0651e8fa71762da90d774e3aa290883 (diff) | |
download | podman-ba430bfe5ef65d5aa5ffa1fef0087da76aafcc35.tar.gz podman-ba430bfe5ef65d5aa5ffa1fef0087da76aafcc35.tar.bz2 podman-ba430bfe5ef65d5aa5ffa1fef0087da76aafcc35.zip |
podman v2 remove bloat v2
rid ourseleves of libpod references in v2 client
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/ps')
-rw-r--r-- | pkg/ps/ps.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/pkg/ps/ps.go b/pkg/ps/ps.go index 8b62fc307..d0fef65c8 100644 --- a/pkg/ps/ps.go +++ b/pkg/ps/ps.go @@ -55,7 +55,7 @@ func GetContainerLists(runtime *libpod.Runtime, options entities.ContainerListOp } if options.Last > 0 { // Sort the containers we got - sort.Sort(entities.SortCreateTime{SortContainers: cons}) + sort.Sort(SortCreateTime{SortContainers: cons}) // we should perform the lopping before we start getting // the expensive information on containers if options.Last < len(cons) { @@ -205,3 +205,15 @@ func getStrFromSquareBrackets(cmd string) string { arr := strings.Split(reg.ReplaceAllLiteralString(cmd, ""), ",") return strings.Join(arr, ",") } + +// SortContainers helps us set-up ability to sort by createTime +type SortContainers []*libpod.Container + +func (a SortContainers) Len() int { return len(a) } +func (a SortContainers) Swap(i, j int) { a[i], a[j] = a[j], a[i] } + +type SortCreateTime struct{ SortContainers } + +func (a SortCreateTime) Less(i, j int) bool { + return a.SortContainers[i].CreatedTime().Before(a.SortContainers[j].CreatedTime()) +} |