code.vegaprotocol.io/vega@v0.79.0/cmd/vega/commands/cometbft.go (about) 1 // Copyright (C) 2023 Gobalsky Labs Limited 2 // 3 // This program is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU Affero General Public License as 5 // published by the Free Software Foundation, either version 3 of the 6 // License, or (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU Affero General Public License for more details. 12 // 13 // You should have received a copy of the GNU Affero General Public License 14 // along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16 package commands 17 18 import ( 19 "context" 20 "os" 21 "path/filepath" 22 23 cmtcmd "github.com/cometbft/cometbft/cmd/cometbft/commands" 24 cmtdebug "github.com/cometbft/cometbft/cmd/cometbft/commands/debug" 25 cmtcfg "github.com/cometbft/cometbft/config" 26 cmtcli "github.com/cometbft/cometbft/libs/cli" 27 "github.com/jessevdk/go-flags" 28 ) 29 30 func Tm(_ context.Context, parser *flags.Parser) error { 31 _, err := parser.AddCommand( 32 "tm", 33 "deprecated, see vega cometbft instead", 34 "deprecated, see vega cometbft instead", 35 &cometbftCmd{}, 36 ) 37 38 return err 39 } 40 41 func Tendermint(_ context.Context, parser *flags.Parser) error { 42 _, err := parser.AddCommand( 43 "tendermint", 44 "deprecated, see vega cometbft instead", 45 "deprecated, see vega cometbft instead", 46 &cometbftCmd{}, 47 ) 48 49 return err 50 } 51 52 func CometBFT(_ context.Context, parser *flags.Parser) error { 53 _, err := parser.AddCommand( 54 "cometbft", 55 "Run cometbft commands", 56 "Run cometbft commands", 57 &cometbftCmd{}, 58 ) 59 60 return err 61 } 62 63 type cometbftCmd struct{} 64 65 func (opts *cometbftCmd) Execute(_ []string) error { 66 os.Args = os.Args[1:] 67 rootCmd := cmtcmd.RootCmd 68 rootCmd.AddCommand( 69 cmtcmd.GenValidatorCmd, 70 cmtcmd.InitFilesCmd, 71 cmtcmd.LightCmd, 72 cmtcmd.ReplayCmd, 73 cmtcmd.ReplayConsoleCmd, 74 cmtcmd.ResetAllCmd, 75 cmtcmd.ResetPrivValidatorCmd, 76 cmtcmd.ResetStateCmd, 77 cmtcmd.ShowValidatorCmd, 78 cmtcmd.TestnetFilesCmd, 79 cmtcmd.ShowNodeIDCmd, 80 cmtcmd.GenNodeKeyCmd, 81 cmtcmd.VersionCmd, 82 cmtcmd.RollbackStateCmd, 83 cmtcmd.CompactGoLevelDBCmd, 84 cmtdebug.DebugCmd, 85 cmtcli.NewCompletionCmd(rootCmd, true), 86 ) 87 88 baseCmd := cmtcli.PrepareBaseCmd(rootCmd, "CMT", os.ExpandEnv(filepath.Join("$HOME", cmtcfg.DefaultTendermintDir))) 89 if err := baseCmd.Execute(); err != nil { 90 return err 91 } 92 93 return nil 94 }