github.com/iotexproject/iotex-core@v1.14.1-rc1/ioctl/cmd/did/did.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 did 7 8 import ( 9 "github.com/spf13/cobra" 10 11 "github.com/iotexproject/iotex-core/ioctl/config" 12 ) 13 14 // Multi-language support 15 var ( 16 DIDCmdShorts = map[config.Language]string{ 17 config.English: "DID command", 18 config.Chinese: "DID command", 19 } 20 _flagEndpoint = map[config.Language]string{ 21 config.English: "set endpoint for once", 22 config.Chinese: "一次设置端点", 23 } 24 _flagInsecure = map[config.Language]string{ 25 config.English: "insecure connection for once", 26 config.Chinese: "一次不安全连接", 27 } 28 ) 29 30 // DIDCmd represents the DID command 31 var DIDCmd = &cobra.Command{ 32 Use: "did", 33 Short: config.TranslateInLang(DIDCmdShorts, config.UILanguage), 34 } 35 36 func init() { 37 DIDCmd.AddCommand(_didGenerateCmd) 38 DIDCmd.AddCommand(_didRegisterCmd) 39 DIDCmd.AddCommand(_didGetCmd) 40 DIDCmd.AddCommand(_didDeregisterCmd) 41 DIDCmd.AddCommand(_didServiceAddCmd) 42 DIDCmd.AddCommand(_didServiceRemoveCmd) 43 DIDCmd.PersistentFlags().StringVar(&config.ReadConfig.Endpoint, "endpoint", 44 config.ReadConfig.Endpoint, config.TranslateInLang(_flagEndpoint, config.UILanguage)) 45 DIDCmd.PersistentFlags().BoolVar(&config.Insecure, "insecure", config.Insecure, config.TranslateInLang(_flagInsecure, config.UILanguage)) 46 }