code.vegaprotocol.io/vega@v0.79.0/cmd/vegatools/root.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 tools 17 18 import ( 19 "context" 20 21 "code.vegaprotocol.io/vega/core/config" 22 23 "github.com/jessevdk/go-flags" 24 ) 25 26 type RootCmd struct { 27 // Global options 28 config.VegaHomeFlag 29 30 // Subcommands 31 Snapshot snapshotCmd `command:"snapshot" description:"Display information about saved snapshots"` 32 Checkpoint checkpointCmd `command:"checkpoint" description:"Make checkpoint human-readable, or generate checkpoint from human readable format"` 33 Stream streamCmd `command:"stream" description:"Stream events from vega node"` 34 CheckTx checkTxCmd `command:"check-tx" description:"Check an encoded transaction from a dependent app is unmarshalled and re-encoded back to the same encoded value. Checks data integrity"` 35 Events eventsCmd `command:"events" description:"Parse event files written by a core node and write them in humna-readble form"` 36 } 37 38 var rootCmd RootCmd 39 40 func VegaTools(ctx context.Context, parser *flags.Parser) error { 41 rootCmd = RootCmd{ 42 Snapshot: snapshotCmd{}, 43 Checkpoint: checkpointCmd{}, 44 Stream: streamCmd{}, 45 CheckTx: checkTxCmd{}, 46 Events: eventsCmd{}, 47 } 48 49 var ( 50 short = "useful tooling for probing a vega node and its state" 51 long = `useful tooling for probing a vega node and its state` 52 ) 53 _, err := parser.AddCommand("tools", short, long, &rootCmd) 54 return err 55 }