Skip to content

Commit

Permalink
Sort services from stack from swarm
Browse files Browse the repository at this point in the history
Signed-off-by: Paweł Szczekutowicz <[email protected]>
  • Loading branch information
pszczekutowicz committed Sep 2, 2019
1 parent e505a7c commit 3444785
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cli/command/stack/swarm/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package swarm
import (
"context"
"fmt"
"sort"

"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/service"
"github.com/docker/cli/cli/command/stack/formatter"
"github.com/docker/cli/cli/command/stack/options"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"vbom.ml/util/sortorder"
)

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

sort.Slice(services, func(i, j int) bool {
return sortorder.NaturalLess(services[i].Spec.Name, services[j].Spec.Name)
})
info := map[string]service.ListInfo{}
if !opts.Quiet {
taskFilter := filters.NewArgs()
Expand Down

0 comments on commit 3444785

Please sign in to comment.