match returns true if any of the values at key match the source string
(filters client.Filters, field, source string)
| 66 | |
| 67 | // match returns true if any of the values at key match the source string |
| 68 | func match(filters client.Filters, field, source string) bool { |
| 69 | if f, ok := filters[field]; ok && f[source] { |
| 70 | return true |
| 71 | } |
| 72 | |
| 73 | fieldValues := filters[field] |
| 74 | for name2match := range fieldValues { |
| 75 | isMatch, err := regexp.MatchString(name2match, source) |
| 76 | if err != nil { |
| 77 | continue |
| 78 | } |
| 79 | if isMatch { |
| 80 | return true |
| 81 | } |
| 82 | } |
| 83 | return false |
| 84 | } |
| 85 | |
| 86 | func runList(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, lsOpts lsOptions) error { |
| 87 | filters := lsOpts.Filter.Value() |