Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit c58e061

Browse files
Sort services from stack from swarm
Signed-off-by: Paweł Szczekutowicz <[email protected]> Upstream-commit: 34447852b5db40a40359d12e8e59b92d7881f7f0 Component: cli
1 parent c58dda0 commit c58e061

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

components/cli/cli/command/stack/swarm/services.go

+5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ package swarm
33
import (
44
"context"
55
"fmt"
6+
"sort"
67

78
"github.com/docker/cli/cli/command"
89
"github.com/docker/cli/cli/command/service"
910
"github.com/docker/cli/cli/command/stack/formatter"
1011
"github.com/docker/cli/cli/command/stack/options"
1112
"github.com/docker/docker/api/types"
1213
"github.com/docker/docker/api/types/filters"
14+
"vbom.ml/util/sortorder"
1315
)
1416

1517
// RunServices is the swarm implementation of docker stack services
@@ -29,6 +31,9 @@ func RunServices(dockerCli command.Cli, opts options.Services) error {
2931
return nil
3032
}
3133

34+
sort.Slice(services, func(i, j int) bool {
35+
return sortorder.NaturalLess(services[i].Spec.Name, services[j].Spec.Name)
36+
})
3237
info := map[string]service.ListInfo{}
3338
if !opts.Quiet {
3439
taskFilter := filters.NewArgs()

0 commit comments

Comments
 (0)