github.com/turingchain2020/turingchain@v1.1.21/system/dapp/commands/version.go (about)

     1  // Copyright Turing Corp. 2018 All Rights Reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package commands 系统级dapp相关命令包
     6  package commands
     7  
     8  import (
     9  	"github.com/turingchain2020/turingchain/rpc/jsonclient"
    10  	"github.com/turingchain2020/turingchain/types"
    11  	"github.com/spf13/cobra"
    12  )
    13  
    14  // VersionCmd version command
    15  func VersionCmd() *cobra.Command {
    16  	cmd := &cobra.Command{
    17  		Use:   "version",
    18  		Short: "Get node version",
    19  		Run:   version,
    20  	}
    21  
    22  	return cmd
    23  }
    24  
    25  func version(cmd *cobra.Command, args []string) {
    26  	rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
    27  	var res types.VersionInfo
    28  	ctx := jsonclient.NewRPCCtx(rpcLaddr, "Turingchain.Version", nil, &res)
    29  	ctx.Run()
    30  
    31  }