diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-11-18 18:55:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 18:55:05 +0100 |
commit | 61a82159dbb154b2044595b156dbdb9fac04bedd (patch) | |
tree | 55a9809a4eb587344f80e702eab7b4b5609995ac /pkg/ps/ps.go | |
parent | dcd498a6885f0293934214af0c6fc2d3c7717bd5 (diff) | |
parent | 4f427a89cbc0814c25dd4b562ddf4ff4e568a005 (diff) | |
download | podman-61a82159dbb154b2044595b156dbdb9fac04bedd.tar.gz podman-61a82159dbb154b2044595b156dbdb9fac04bedd.tar.bz2 podman-61a82159dbb154b2044595b156dbdb9fac04bedd.zip |
Merge pull request #8376 from Luap99/podman-filters
Align the podman ps --filter behavior with docker
Diffstat (limited to 'pkg/ps/ps.go')
-rw-r--r-- | pkg/ps/ps.go | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/pkg/ps/ps.go b/pkg/ps/ps.go index 96b2d754f..3dd7eb0c6 100644 --- a/pkg/ps/ps.go +++ b/pkg/ps/ps.go @@ -21,19 +21,17 @@ import ( func GetContainerLists(runtime *libpod.Runtime, options entities.ContainerListOptions) ([]entities.ListContainer, error) { var ( - filterFuncs []libpod.ContainerFilter - pss = []entities.ListContainer{} + pss = []entities.ListContainer{} ) + filterFuncs := make([]libpod.ContainerFilter, 0, len(options.Filters)) all := options.All || options.Last > 0 if len(options.Filters) > 0 { for k, v := range options.Filters { - for _, val := range v { - generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, val, runtime) - if err != nil { - return nil, err - } - filterFuncs = append(filterFuncs, generatedFunc) + generatedFunc, err := lpfilters.GenerateContainerFilterFuncs(k, v, runtime) + if err != nil { + return nil, err } + filterFuncs = append(filterFuncs, generatedFunc) } } @@ -43,7 +41,7 @@ func GetContainerLists(runtime *libpod.Runtime, options entities.ContainerListOp all = true } if !all { - runningOnly, err := lpfilters.GenerateContainerFilterFuncs("status", define.ContainerStateRunning.String(), runtime) + runningOnly, err := lpfilters.GenerateContainerFilterFuncs("status", []string{define.ContainerStateRunning.String()}, runtime) if err != nil { return nil, err } |