mirror of https://github.com/docker/cli.git
Merge pull request #27948 from WeiZhang555/consistent-filters
Replace all "Filter" field with "Filters" for consistency
This commit is contained in:
commit
81e6e5e36d
|
@ -82,7 +82,7 @@ func buildContainerListOptions(opts *psOptions) (*types.ContainerListOptions, er
|
||||||
All: opts.all,
|
All: opts.all,
|
||||||
Limit: opts.last,
|
Limit: opts.last,
|
||||||
Size: opts.size,
|
Size: opts.size,
|
||||||
Filter: opts.filter.Value(),
|
Filters: opts.filter.Value(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.nLatest && opts.last == -1 {
|
if opts.nLatest && opts.last == -1 {
|
||||||
|
|
|
@ -55,10 +55,10 @@ func TestBuildContainerListOptions(t *testing.T) {
|
||||||
assert.Equal(t, c.expectedAll, options.All)
|
assert.Equal(t, c.expectedAll, options.All)
|
||||||
assert.Equal(t, c.expectedSize, options.Size)
|
assert.Equal(t, c.expectedSize, options.Size)
|
||||||
assert.Equal(t, c.expectedLimit, options.Limit)
|
assert.Equal(t, c.expectedLimit, options.Limit)
|
||||||
assert.Equal(t, options.Filter.Len(), len(c.expectedFilters))
|
assert.Equal(t, options.Filters.Len(), len(c.expectedFilters))
|
||||||
|
|
||||||
for k, v := range c.expectedFilters {
|
for k, v := range c.expectedFilters {
|
||||||
f := options.Filter
|
f := options.Filters
|
||||||
if !f.ExactMatch(k, v) {
|
if !f.ExactMatch(k, v) {
|
||||||
t.Fatalf("Expected filter with key %s to be %s but got %s", k, v, f.Get(k))
|
t.Fatalf("Expected filter with key %s to be %s but got %s", k, v, f.Get(k))
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ func runList(dockerCli *command.DockerCli, opts listOptions) error {
|
||||||
|
|
||||||
nodes, err := client.NodeList(
|
nodes, err := client.NodeList(
|
||||||
ctx,
|
ctx,
|
||||||
types.NodeListOptions{Filter: opts.filter.Value()})
|
types.NodeListOptions{Filters: opts.filter.Value()})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ func runPs(dockerCli *command.DockerCli, opts psOptions) error {
|
||||||
filter := opts.filter.Value()
|
filter := opts.filter.Value()
|
||||||
filter.Add("node", node.ID)
|
filter.Add("node", node.ID)
|
||||||
|
|
||||||
nodeTasks, err := client.TaskList(ctx, types.TaskListOptions{Filter: filter})
|
nodeTasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = append(errs, err.Error())
|
errs = append(errs, err.Error())
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -51,7 +51,7 @@ func runList(dockerCli *command.DockerCli, opts listOptions) error {
|
||||||
client := dockerCli.Client()
|
client := dockerCli.Client()
|
||||||
out := dockerCli.Out()
|
out := dockerCli.Out()
|
||||||
|
|
||||||
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filter: opts.filter.Value()})
|
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: opts.filter.Value()})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ func runList(dockerCli *command.DockerCli, opts listOptions) error {
|
||||||
taskFilter.Add("service", service.ID)
|
taskFilter.Add("service", service.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filter: taskFilter})
|
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: taskFilter})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ func runPS(dockerCli *command.DockerCli, opts psOptions) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filter: filter})
|
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ func getServices(
|
||||||
) ([]swarm.Service, error) {
|
) ([]swarm.Service, error) {
|
||||||
return apiclient.ServiceList(
|
return apiclient.ServiceList(
|
||||||
ctx,
|
ctx,
|
||||||
types.ServiceListOptions{Filter: getStackFilter(namespace)})
|
types.ServiceListOptions{Filters: getStackFilter(namespace)})
|
||||||
}
|
}
|
||||||
|
|
||||||
func getNetworks(
|
func getNetworks(
|
||||||
|
|
|
@ -87,7 +87,7 @@ func getStacks(
|
||||||
|
|
||||||
services, err := apiclient.ServiceList(
|
services, err := apiclient.ServiceList(
|
||||||
ctx,
|
ctx,
|
||||||
types.ServiceListOptions{Filter: filter})
|
types.ServiceListOptions{Filters: filter})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ func runPS(dockerCli *command.DockerCli, opts psOptions) error {
|
||||||
filter.Add("desired-state", string(swarm.TaskStateAccepted))
|
filter.Add("desired-state", string(swarm.TaskStateAccepted))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filter: filter})
|
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ func runServices(dockerCli *command.DockerCli, opts servicesOptions) error {
|
||||||
filter := opts.filter.Value()
|
filter := opts.filter.Value()
|
||||||
filter.Add("label", labelNamespace+"="+opts.namespace)
|
filter.Add("label", labelNamespace+"="+opts.namespace)
|
||||||
|
|
||||||
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filter: filter})
|
services, err := client.ServiceList(ctx, types.ServiceListOptions{Filters: filter})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ func runServices(dockerCli *command.DockerCli, opts servicesOptions) error {
|
||||||
taskFilter.Add("service", service.ID)
|
taskFilter.Add("service", service.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filter: taskFilter})
|
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: taskFilter})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue