github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/internal/peer/node/node.go (about) 1 /* 2 Copyright hechain. 2022 All Rights Reserved. 3 SPDX-License-Identifier: Apache-2.0 4 */ 5 6 package node 7 8 import ( 9 "fmt" 10 11 "github.com/hechain20/hechain/common/flogging" 12 "github.com/hechain20/hechain/internal/peer/common" 13 "github.com/spf13/cobra" 14 ) 15 16 const ( 17 nodeFuncName = "node" 18 nodeCmdDes = "Operate a peer node: start|reset|rollback|pause|resume|rebuild-dbs|unjoin|upgrade-dbs." 19 ) 20 21 var logger = flogging.MustGetLogger("nodeCmd") 22 23 // Cmd returns the cobra command for Node 24 func Cmd() *cobra.Command { 25 nodeCmd.AddCommand(startCmd()) 26 nodeCmd.AddCommand(resetCmd()) 27 nodeCmd.AddCommand(rollbackCmd()) 28 nodeCmd.AddCommand(pauseCmd()) 29 nodeCmd.AddCommand(resumeCmd()) 30 nodeCmd.AddCommand(rebuildDBsCmd()) 31 nodeCmd.AddCommand(unjoinCmd()) 32 nodeCmd.AddCommand(upgradeDBsCmd()) 33 return nodeCmd 34 } 35 36 var nodeCmd = &cobra.Command{ 37 Use: nodeFuncName, 38 Short: fmt.Sprint(nodeCmdDes), 39 Long: fmt.Sprint(nodeCmdDes), 40 PersistentPreRun: common.InitCmd, 41 }