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

     1  package ws
     2  
     3  import (
     4  	"github.com/spf13/cobra"
     5  
     6  	"github.com/iotexproject/iotex-core/ioctl/config"
     7  )
     8  
     9  var (
    10  	// WsCmd represents the w3bstream command
    11  	WsCmd = &cobra.Command{
    12  		Use:   "ws",
    13  		Short: config.TranslateInLang(wsCmdShorts, config.UILanguage),
    14  	}
    15  
    16  	// wsCmdShorts command multi-lang supports
    17  	wsCmdShorts = map[config.Language]string{
    18  		config.English: "W3bstream node operations",
    19  		config.Chinese: "W3bstream节点操作",
    20  	}
    21  
    22  	_flagChainEndpointUsages = map[config.Language]string{
    23  		config.English: "set endpoint for once",
    24  		config.Chinese: "一次设置端点",
    25  	}
    26  
    27  	_flagWsEndpointUsages = map[config.Language]string{
    28  		config.English: "set w3bsteram endpoint for once",
    29  		config.Chinese: "一次设置w3bstream端点",
    30  	}
    31  
    32  	_flagIPFSEndpointUsages = map[config.Language]string{
    33  		config.English: "set ipfs endpoint for resource uploading for once",
    34  		config.Chinese: "一次设置ipfs端点",
    35  	}
    36  
    37  	_flagIPFSGatewayUsages = map[config.Language]string{
    38  		config.English: "set ipfs gateway for resource fetching for once",
    39  		config.Chinese: "一次设置ipfs网关",
    40  	}
    41  
    42  	_flagContractAddressUsages = map[config.Language]string{
    43  		config.English: "set w3bsteram project register contract address for once",
    44  		config.Chinese: "一次设置w3bstream项目注册合约地址",
    45  	}
    46  )
    47  
    48  func init() {
    49  	WsCmd.AddCommand(wsMessage)
    50  	WsCmd.AddCommand(wsCode)
    51  	WsCmd.AddCommand(wsProject)
    52  
    53  	WsCmd.PersistentFlags().StringVar(
    54  		&config.ReadConfig.Endpoint, "endpoint",
    55  		config.ReadConfig.Endpoint, config.TranslateInLang(_flagChainEndpointUsages, config.UILanguage),
    56  	)
    57  	WsCmd.PersistentFlags().StringVar(
    58  		&config.ReadConfig.WsEndpoint, "ws-endpoint",
    59  		config.ReadConfig.WsEndpoint, config.TranslateInLang(_flagWsEndpointUsages, config.UILanguage),
    60  	)
    61  	WsCmd.PersistentFlags().StringVar(
    62  		&config.ReadConfig.IPFSEndpoint, "ipfs-endpoint",
    63  		config.ReadConfig.IPFSEndpoint, config.TranslateInLang(_flagIPFSEndpointUsages, config.UILanguage),
    64  	)
    65  	WsCmd.PersistentFlags().StringVar(
    66  		&config.ReadConfig.IPFSGateway, "ipfs-gateway",
    67  		config.ReadConfig.IPFSGateway, config.TranslateInLang(_flagIPFSGatewayUsages, config.UILanguage),
    68  	)
    69  	WsCmd.PersistentFlags().StringVar(
    70  		&config.ReadConfig.WsRegisterContract, "contract-address",
    71  		config.ReadConfig.WsRegisterContract, config.TranslateInLang(_flagContractAddressUsages, config.UILanguage),
    72  	)
    73  }