mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-19 13:46:17 +00:00
clean up cli
This commit is contained in:
@@ -3,6 +3,7 @@ package debug
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
)
|
||||
|
||||
@@ -12,7 +13,7 @@ const (
|
||||
flagFrequency = "frequency"
|
||||
)
|
||||
|
||||
func GetDebugCommand(logger log.Logger) *cobra.Command {
|
||||
func GetDebugCommand(conf *config.Config, logger log.Logger) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "debug",
|
||||
Short: "A utility to kill or watch a Tendermint process while aggregating debugging data",
|
||||
@@ -25,7 +26,7 @@ func GetDebugCommand(logger log.Logger) *cobra.Command {
|
||||
)
|
||||
|
||||
cmd.AddCommand(getKillCmd(logger))
|
||||
cmd.AddCommand(getDumpCmd(logger))
|
||||
cmd.AddCommand(getDumpCmd(conf, logger))
|
||||
return cmd
|
||||
|
||||
}
|
||||
|
||||
@@ -9,15 +9,12 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/tendermint/tendermint/cmd/tendermint/commands"
|
||||
"github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
|
||||
)
|
||||
|
||||
func getDumpCmd(logger log.Logger) *cobra.Command {
|
||||
func getDumpCmd(conf *config.Config, logger log.Logger) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "dump [output-directory]",
|
||||
Short: "Continuously poll a Tendermint process and dump debugging data into a single location",
|
||||
@@ -63,11 +60,6 @@ if enabled.`,
|
||||
|
||||
ctx := cmd.Context()
|
||||
|
||||
home := viper.GetString(commands.HomeFlag)
|
||||
conf := config.DefaultConfig()
|
||||
conf = conf.SetRoot(home)
|
||||
config.EnsureRoot(conf.RootDir)
|
||||
|
||||
dumpArgs := dumpDebugDataArgs{
|
||||
conf: conf,
|
||||
outDir: outDir,
|
||||
|
||||
@@ -51,7 +51,7 @@ func main() {
|
||||
commands.MakeInspectCommand(conf, logger),
|
||||
commands.MakeRollbackStateCommand(conf),
|
||||
commands.MakeKeyMigrateCommand(conf, logger),
|
||||
debug.GetDebugCommand(logger),
|
||||
debug.GetDebugCommand(conf, logger),
|
||||
commands.NewCompletionCmd(rcmd, true),
|
||||
commands.MakeCompactDBCommand(conf, logger),
|
||||
)
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ func Load(rootDir string) (*Config, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
config.SetRoot(config.RootDir)
|
||||
config.SetRoot(rootDir)
|
||||
|
||||
if err := config.ValidateBasic(); err != nil {
|
||||
return nil, fmt.Errorf("error in config file: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user