github.com/iotexproject/iotex-core@v1.14.1-rc1/ioctl/cmd/node/node.go (about)

     1  // Copyright (c) 2022 IoTeX Foundation
     2  // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
     3  // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
     4  // This source code is governed by Apache License 2.0 that can be found in the LICENSE file.
     5  
     6  package node
     7  
     8  import (
     9  	"github.com/spf13/cobra"
    10  
    11  	"github.com/iotexproject/iotex-core/ioctl/config"
    12  	"github.com/iotexproject/iotex-core/ioctl/flag"
    13  )
    14  
    15  // Multi-language support
    16  var (
    17  	_nodeCmdShorts = map[config.Language]string{
    18  		config.English: "Deal with nodes of IoTeX blockchain",
    19  		config.Chinese: "处理IoTeX区块链的节点",
    20  	}
    21  	_flagEndpointUsages = map[config.Language]string{
    22  		config.English: "set endpoint for once",
    23  		config.Chinese: "一次设置端点",
    24  	}
    25  	_flagInsecureUsages = map[config.Language]string{
    26  		config.English: "insecure connection for once",
    27  		config.Chinese: "一次不安全的连接",
    28  	}
    29  	_allFlag = flag.BoolVarP("all", "a", false, "returns all delegates")
    30  )
    31  
    32  // NodeCmd represents the node command
    33  var NodeCmd = &cobra.Command{
    34  	Use:   "node",
    35  	Short: config.TranslateInLang(_nodeCmdShorts, config.UILanguage),
    36  }
    37  
    38  func init() {
    39  	NodeCmd.AddCommand(_nodeDelegateCmd)
    40  	NodeCmd.AddCommand(_nodeRewardCmd)
    41  	NodeCmd.AddCommand(_nodeProbationlistCmd)
    42  	NodeCmd.PersistentFlags().StringVar(&config.ReadConfig.Endpoint, "endpoint",
    43  		config.ReadConfig.Endpoint, config.TranslateInLang(_flagEndpointUsages, config.UILanguage))
    44  	NodeCmd.PersistentFlags().BoolVar(&config.Insecure, "insecure", config.Insecure,
    45  		config.TranslateInLang(_flagInsecureUsages, config.UILanguage))
    46  	_allFlag.RegisterCommand(_nodeDelegateCmd)
    47  }