diff options
author | Boaz Shuster <boaz.shuster.github@gmail.com> | 2022-06-15 12:40:11 +0300 |
---|---|---|
committer | Boaz Shuster <boaz.shuster.github@gmail.com> | 2022-06-27 21:34:39 +0300 |
commit | 3b10c1b78a8aa2acab59d1a99a010437a73a50b8 (patch) | |
tree | 8f0850f53d3ad4f978c25e11555a84b2d1d1f61d /pkg/domain | |
parent | 9c4b8a29b06c179725983e7fa8fadf7ee68d9863 (diff) | |
download | podman-3b10c1b78a8aa2acab59d1a99a010437a73a50b8.tar.gz podman-3b10c1b78a8aa2acab59d1a99a010437a73a50b8.tar.bz2 podman-3b10c1b78a8aa2acab59d1a99a010437a73a50b8.zip |
Use Regexp in volume ls --filter name
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/filters/volumes.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/domain/filters/volumes.go b/pkg/domain/filters/volumes.go index e88bd4228..a18e6332c 100644 --- a/pkg/domain/filters/volumes.go +++ b/pkg/domain/filters/volumes.go @@ -2,6 +2,7 @@ package filters import ( "net/url" + "regexp" "strings" "github.com/containers/podman/v4/libpod" @@ -15,9 +16,12 @@ func GenerateVolumeFilters(filters url.Values) ([]libpod.VolumeFilter, error) { for _, val := range v { switch filter { case "name": - nameVal := val + nameRegexp, err := regexp.Compile(val) + if err != nil { + return nil, err + } vf = append(vf, func(v *libpod.Volume) bool { - return nameVal == v.Name() + return nameRegexp.MatchString(v.Name()) }) case "driver": driverVal := val |