diff options
Diffstat (limited to 'cmd/podman/parse')
-rw-r--r-- | cmd/podman/parse/filters.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cmd/podman/parse/filters.go b/cmd/podman/parse/filters.go new file mode 100644 index 000000000..8a10f2a97 --- /dev/null +++ b/cmd/podman/parse/filters.go @@ -0,0 +1,20 @@ +package parse + +import ( + "net/url" + "strings" + + "github.com/pkg/errors" +) + +func FilterArgumentsIntoFilters(filters []string) (url.Values, error) { + parsedFilters := make(url.Values) + for _, f := range filters { + t := strings.SplitN(f, "=", 2) + if len(t) < 2 { + return parsedFilters, errors.Errorf("filter input must be in the form of filter=value: %s is invalid", f) + } + parsedFilters.Add(t[0], t[1]) + } + return parsedFilters, nil +} |