mirror of
https://github.com/moby/moby.git
synced 2025-12-24 13:21:20 +03:00
filter flag: split out for separate --filter flags
adding tests and allowing for easy passing of filters.Args from client to server. Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
This commit is contained in:
@@ -1160,10 +1160,10 @@ func (cli *DockerCli) CmdImages(args ...string) error {
|
||||
|
||||
// Consolidate all filter flags, and sanity check them early.
|
||||
// They'll get process in the daemon/server.
|
||||
imageFilters := map[string]string{}
|
||||
imageFilterArgs := filters.Args{}
|
||||
for _, f := range flFilter.GetAll() {
|
||||
var err error
|
||||
imageFilters, err = filters.ParseFlag(f, imageFilters)
|
||||
imageFilterArgs, err = filters.ParseFlag(f, imageFilterArgs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1174,7 +1174,7 @@ func (cli *DockerCli) CmdImages(args ...string) error {
|
||||
if *flViz || *flTree {
|
||||
v := url.Values{
|
||||
"all": []string{"1"},
|
||||
"filters": []string{filters.ToParam(imageFilters)},
|
||||
"filters": []string{filters.ToParam(imageFilterArgs)},
|
||||
}
|
||||
body, _, err := readBody(cli.call("GET", "/images/json?"+v.Encode(), nil, false))
|
||||
if err != nil {
|
||||
@@ -1238,7 +1238,7 @@ func (cli *DockerCli) CmdImages(args ...string) error {
|
||||
}
|
||||
} else {
|
||||
v := url.Values{
|
||||
"filters": []string{filters.ToParam(imageFilters)},
|
||||
"filters": []string{filters.ToParam(imageFilterArgs)},
|
||||
}
|
||||
if cmd.NArg() == 1 {
|
||||
// FIXME rename this parameter, to not be confused with the filters flag
|
||||
|
||||
Reference in New Issue
Block a user