summaryrefslogtreecommitdiff
path: root/pkg/util/utils.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-11-18 18:55:05 +0100
committerGitHub <noreply@github.com>2020-11-18 18:55:05 +0100
commit61a82159dbb154b2044595b156dbdb9fac04bedd (patch)
tree55a9809a4eb587344f80e702eab7b4b5609995ac /pkg/util/utils.go
parentdcd498a6885f0293934214af0c6fc2d3c7717bd5 (diff)
parent4f427a89cbc0814c25dd4b562ddf4ff4e568a005 (diff)
downloadpodman-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/util/utils.go')
-rw-r--r--pkg/util/utils.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/util/utils.go b/pkg/util/utils.go
index 415fd169b..f6a084c00 100644
--- a/pkg/util/utils.go
+++ b/pkg/util/utils.go
@@ -6,6 +6,7 @@ import (
"os"
"os/user"
"path/filepath"
+ "regexp"
"strconv"
"strings"
"sync"
@@ -84,6 +85,17 @@ func StringInSlice(s string, sl []string) bool {
return false
}
+// StringMatchRegexSlice determines if a given string matches one of the given regexes, returns bool
+func StringMatchRegexSlice(s string, re []string) bool {
+ for _, r := range re {
+ m, err := regexp.MatchString(r, s)
+ if err == nil && m {
+ return true
+ }
+ }
+ return false
+}
+
// ImageConfig is a wrapper around the OCIv1 Image Configuration struct exported
// by containers/image, but containing additional fields that are not supported
// by OCIv1 (but are by Docker v2) - notably OnBuild.