mirror of
https://github.com/containers/podman.git
synced 2025-06-22 09:58:10 +08:00
Merge pull request #8238 from joelsmith/master
Use regex for "pod ps" name filter to match "ps" behavior
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package lpfilters
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@ -78,7 +79,11 @@ func GeneratePodFilterFunc(filter, filterValue string) (
|
||||
}, nil
|
||||
case "name":
|
||||
return func(p *libpod.Pod) bool {
|
||||
return strings.Contains(p.Name(), filterValue)
|
||||
match, err := regexp.MatchString(filterValue, p.Name())
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return match
|
||||
}, nil
|
||||
case "status":
|
||||
if !util.StringInSlice(filterValue, []string{"stopped", "running", "paused", "exited", "dead", "created"}) {
|
||||
|
Reference in New Issue
Block a user