diff --git a/cmd/network/status.go b/cmd/network/status.go index 80ca427f..98a4aecf 100644 --- a/cmd/network/status.go +++ b/cmd/network/status.go @@ -3,12 +3,15 @@ package network import ( "context" "fmt" + "sort" "strings" "time" "github.com/spf13/cobra" flag "github.com/spf13/pflag" + coreCommon "github.com/oasisprotocol/oasis-core/go/common" + "github.com/oasisprotocol/oasis-sdk/client-sdk/go/connection" "github.com/oasisprotocol/cli/cmd/common" @@ -132,7 +135,22 @@ var ( fmt.Println("==== ParaTimes ====") } - for _, runtime := range nodeStatus.Runtimes { + keys := make([][]interface{}, 0, len(nodeStatus.Runtimes)) + for key, runtime := range nodeStatus.Runtimes { + descriptor := runtime.Descriptor + paratimeName := "unknown" + if descriptor != nil { + paratimeName = getParatimeName(cfg, descriptor.ID.String()) + } + newRow := []interface{}{key, paratimeName} + keys = append(keys, newRow) + } + sort.Slice(keys, func(i, j int) bool { + return keys[i][1].(string) < keys[j][1].(string) + }) + + for _, key := range keys { + runtime := nodeStatus.Runtimes[key[0].(coreCommon.Namespace)] descriptor := runtime.Descriptor if descriptor != nil { paratimeName := getParatimeName(cfg, descriptor.ID.String())