github.com/MetalBlockchain/metalgo@v1.11.9/vms/example/xsvm/cmd/version/cmd.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package version 5 6 import ( 7 "fmt" 8 9 "github.com/spf13/cobra" 10 11 "github.com/MetalBlockchain/metalgo/utils/constants" 12 "github.com/MetalBlockchain/metalgo/version" 13 "github.com/MetalBlockchain/metalgo/vms/example/xsvm" 14 ) 15 16 const format = `%s: 17 VMID: %s 18 Version: %s 19 Plugin Version: %d 20 ` 21 22 func Command() *cobra.Command { 23 return &cobra.Command{ 24 Use: "version", 25 Short: "Prints out the version", 26 RunE: versionFunc, 27 } 28 } 29 30 func versionFunc(*cobra.Command, []string) error { 31 fmt.Printf( 32 format, 33 constants.XSVMName, 34 constants.XSVMID, 35 xsvm.Version, 36 version.RPCChainVMProtocol, 37 ) 38 return nil 39 }