/
system.go
43 lines (37 loc) · 1000 Bytes
/
system.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package commands 系统级dapp相关命令包
package commands
import (
"github.com/assetcloud/chain/rpc/jsonclient"
rpctypes "github.com/assetcloud/chain/rpc/types"
"github.com/spf13/cobra"
)
// SystemCmd get system config command
func SystemCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "system",
Short: "Get node system info",
Args: cobra.MinimumNArgs(1),
}
cmd.AddCommand(
getConfigCmd(),
)
return cmd
}
// SystemCmd get system config command
func getConfigCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "config",
Short: "Get node config",
Run: config,
}
return cmd
}
func config(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
var res rpctypes.ChainConfigInfo
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Chain.GetChainConfig", nil, &res)
ctx.Run()
}