Skip to content

Commit 3e6f22e

Browse files
committed
feat(cmd/network/status): Add network names to chain context
1 parent 6571c66 commit 3e6f22e

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

cmd/network/status.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
coreCommon "github.com/oasisprotocol/oasis-core/go/common"
1313

14+
sdkConfig "github.com/oasisprotocol/oasis-sdk/client-sdk/go/config"
1415
"github.com/oasisprotocol/oasis-sdk/client-sdk/go/connection"
1516

1617
"github.com/oasisprotocol/cli/cmd/common"
@@ -28,6 +29,15 @@ func getParatimeName(cfg *cliConfig.Config, id string) string {
2829
return ("unknown")
2930
}
3031

32+
func getNetworkName(context string) string {
33+
for key, net := range sdkConfig.DefaultNetworks.All {
34+
if context == net.ChainContext {
35+
return (key)
36+
}
37+
}
38+
return ("unknown")
39+
}
40+
3141
var statusCmd = &cobra.Command{
3242
Use: "status",
3343
Short: "Show the current status of the node and the network",
@@ -75,7 +85,7 @@ var statusCmd = &cobra.Command{
7585
fmt.Printf("Version: %s", consensus.Version.String())
7686
fmt.Println()
7787

78-
fmt.Printf("Chain context: %s", consensus.ChainContext)
88+
fmt.Printf("Chain context: %s (%s)", getNetworkName(consensus.ChainContext), consensus.ChainContext)
7989
fmt.Println()
8090

8191
date := time.Unix(nodeStatus.Consensus.LatestTime.Unix(), 0)

0 commit comments

Comments
 (0)