summaryrefslogtreecommitdiff
path: root/cmd/podman/shared/container.go
diff options
context:
space:
mode:
authorQi Wang <qiwan@redhat.com>2019-07-18 13:10:37 -0400
committerQi Wang <qiwan@redhat.com>2019-07-18 13:11:04 -0400
commit5047c79e71a336da1fa2e0b8fc6e50811801f878 (patch)
tree8d4eab3628304525286a5612ad78b1c721e90a58 /cmd/podman/shared/container.go
parentadcde2383f1da517c5788516d639745f5f01d300 (diff)
downloadpodman-5047c79e71a336da1fa2e0b8fc6e50811801f878.tar.gz
podman-5047c79e71a336da1fa2e0b8fc6e50811801f878.tar.bz2
podman-5047c79e71a336da1fa2e0b8fc6e50811801f878.zip
support podman ps filter regular expressions
podman ps --filter use regexp to match the container name. Signed-off-by: Qi Wang <qiwan@redhat.com>
Diffstat (limited to 'cmd/podman/shared/container.go')
-rw-r--r--cmd/podman/shared/container.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go
index 3c68a29b4..5492f843f 100644
--- a/cmd/podman/shared/container.go
+++ b/cmd/podman/shared/container.go
@@ -296,7 +296,11 @@ func generateContainerFilterFuncs(filter, filterValue string, r *libpod.Runtime)
}, nil
case "name":
return func(c *libpod.Container) bool {
- return strings.Contains(c.Name(), filterValue)
+ match, err := regexp.MatchString(filterValue, c.Name())
+ if err != nil {
+ return false
+ }
+ return match
}, nil
case "exited":
exitCode, err := strconv.ParseInt(filterValue, 10, 32)