|
@ -3,6 +3,7 @@ package commands |
|
|
import ( |
|
|
import ( |
|
|
"fmt" |
|
|
"fmt" |
|
|
"os" |
|
|
"os" |
|
|
|
|
|
"strings" |
|
|
|
|
|
|
|
|
"github.com/spf13/cobra" |
|
|
"github.com/spf13/cobra" |
|
|
"github.com/spf13/viper" |
|
|
"github.com/spf13/viper" |
|
@ -36,16 +37,16 @@ func ParseConfig() (*cfg.Config, error) { |
|
|
} |
|
|
} |
|
|
conf.SetRoot(conf.RootDir) |
|
|
conf.SetRoot(conf.RootDir) |
|
|
cfg.EnsureRoot(conf.RootDir) |
|
|
cfg.EnsureRoot(conf.RootDir) |
|
|
if err = conf.ValidateBasic(); err != nil { |
|
|
|
|
|
|
|
|
if err := conf.ValidateBasic(); err != nil { |
|
|
return nil, fmt.Errorf("error in config file: %v", err) |
|
|
return nil, fmt.Errorf("error in config file: %v", err) |
|
|
} |
|
|
} |
|
|
return conf, err |
|
|
|
|
|
|
|
|
return conf, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// RootCmd is the root command for Tendermint core.
|
|
|
// RootCmd is the root command for Tendermint core.
|
|
|
var RootCmd = &cobra.Command{ |
|
|
var RootCmd = &cobra.Command{ |
|
|
Use: "tendermint", |
|
|
Use: "tendermint", |
|
|
Short: "Tendermint Core (BFT Consensus) in Go", |
|
|
|
|
|
|
|
|
Short: "BFT state machine replication for applications in any programming languages", |
|
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) { |
|
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) { |
|
|
if cmd.Name() == VersionCmd.Name() { |
|
|
if cmd.Name() == VersionCmd.Name() { |
|
|
return nil |
|
|
return nil |
|
@ -68,3 +69,10 @@ var RootCmd = &cobra.Command{ |
|
|
return nil |
|
|
return nil |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// deprecateSnakeCase is a util function for 0.34.1. Should be removed in 0.35
|
|
|
|
|
|
func deprecateSnakeCase(cmd *cobra.Command, args []string) { |
|
|
|
|
|
if strings.Contains(cmd.CalledAs(), "_") { |
|
|
|
|
|
fmt.Println("Deprecated: snake_case commands will be replaced by hyphen-case commands in the next major release") |
|
|
|
|
|
} |
|
|
|
|
|
} |