use sortorder lib for sorting network list output

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
This commit is contained in:
Arash Deshmeh 2018-08-03 07:08:01 -04:00
parent 1d04f7d66b
commit a921313caf
2 changed files with 3 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import (
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types"
"github.com/spf13/cobra"
"vbom.ml/util/sortorder"
)
type listOptions struct {
@ -59,7 +60,7 @@ func runList(dockerCli command.Cli, options listOptions) error {
}
sort.Slice(networkResources, func(i, j int) bool {
return networkResources[i].Name < networkResources[j].Name
return sortorder.NaturalLess(networkResources[i].Name, networkResources[j].Name)
})
networksCtx := formatter.Context{

View File

@ -1,3 +1,3 @@
network-1-foo
network-10-foo
network-2-foo
network-10-foo