github.com/iotexproject/iotex-core@v1.14.1-rc1/tools/iomigrater/root.go (about) 1 // Copyright (c) 2020 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 main 7 8 import ( 9 "os" 10 11 "github.com/spf13/cobra" 12 13 "github.com/iotexproject/iotex-core/tools/iomigrater/cmds" 14 "github.com/iotexproject/iotex-core/tools/iomigrater/common" 15 ) 16 17 // Multi-language support 18 var ( 19 rootCmdShorts = map[string]string{ 20 "english": "Command-line interface for migration of IoTeX blockchain db file", 21 "chinese": "IoTeX区块链db文件的迁移命令行工具", 22 } 23 rootCmdLongs = map[string]string{ 24 "english": `iomigrater is a command-line interface for interacting with IoTeX blockchain db file.`, 25 "chinese": `ioctl 是用于与IoTeX区块链 db 文件进行交互的命令行工具`, 26 } 27 rootCmdUses = map[string]string{ 28 "english": "iomigrater", 29 "chinese": "iomigrater", 30 } 31 ) 32 33 // RootCmd represents the base command when called without any subcommands 34 var RootCmd = &cobra.Command{ 35 Use: common.TranslateInLang(rootCmdUses), 36 Short: common.TranslateInLang(rootCmdShorts), 37 Long: common.TranslateInLang(rootCmdLongs), 38 } 39 40 // Execute adds all child commands to the root command and sets flags appropriately. 41 func Execute() { 42 if err := RootCmd.Execute(); err != nil { 43 os.Exit(1) 44 } 45 } 46 47 func init() { 48 RootCmd.AddCommand(cmd.CheckHeight) 49 RootCmd.AddCommand(cmd.MigrateDb) 50 51 RootCmd.HelpFunc() 52 }