From a921313cafd9da543087c5f7329b9fd62bb360eb Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Fri, 3 Aug 2018 07:08:01 -0400 Subject: [PATCH] use sortorder lib for sorting network list output Signed-off-by: Arash Deshmeh --- cli/command/network/list.go | 3 ++- cli/command/network/testdata/network-list-sort.golden | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/command/network/list.go b/cli/command/network/list.go index 30c1e7d122..ad286190a4 100644 --- a/cli/command/network/list.go +++ b/cli/command/network/list.go @@ -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{ diff --git a/cli/command/network/testdata/network-list-sort.golden b/cli/command/network/testdata/network-list-sort.golden index 434913823d..165f93953b 100644 --- a/cli/command/network/testdata/network-list-sort.golden +++ b/cli/command/network/testdata/network-list-sort.golden @@ -1,3 +1,3 @@ network-1-foo -network-10-foo network-2-foo +network-10-foo