Skip to content

Commit

Permalink
Merge pull request #764 from cosmos/bucky/cli
Browse files Browse the repository at this point in the history
remove --testnet flag. just output all info on init
  • Loading branch information
ebuchman authored Apr 1, 2018
2 parents e509590 + 8170d87 commit ac4409d
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions server/init.go
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ import (
"io/ioutil"

"github.com/spf13/cobra"
"github.com/spf13/viper"

cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
@@ -17,10 +16,6 @@ import (
tmtypes "github.com/tendermint/tendermint/types"
)

const (
flagTestnet = "testnet"
)

type testnetInformation struct {
Secret string `json:"secret"`
Account string `json:"account"`
@@ -43,11 +38,10 @@ func InitCmd(gen GenAppState, logger log.Logger) *cobra.Command {
Short: "Initialize genesis files",
RunE: cmd.run,
}
cobraCmd.Flags().Bool(flagTestnet, false, "Output testnet information in JSON")
return &cobraCmd
}

// GenAppState can parse command-line and flag to
// GenAppState can parse command-line to
// generate default app_state for the genesis file.
// Also must return generated seed and address
// This is application-specific
@@ -62,10 +56,6 @@ func (c initCmd) run(cmd *cobra.Command, args []string) error {
// Store testnet information as we go
var testnetInfo testnetInformation

if viper.GetBool(flagTestnet) {
c.logger = log.NewFilter(c.logger, log.AllowError())
}

// Run the basic tendermint initialization,
// set up a default genesis with no app_options
config, err := tcmd.ParseConfig()
@@ -97,18 +87,16 @@ func (c initCmd) run(cmd *cobra.Command, args []string) error {
return err
}

if viper.GetBool(flagTestnet) {
nodeKey, err := p2p.LoadOrGenNodeKey(config.NodeKeyFile())
if err != nil {
return err
}
testnetInfo.NodeID = nodeKey.ID()
out, err := json.MarshalIndent(testnetInfo, "", " ")
if err != nil {
return err
}
fmt.Println(string(out))
nodeKey, err := p2p.LoadOrGenNodeKey(config.NodeKeyFile())
if err != nil {
return err
}
testnetInfo.NodeID = nodeKey.ID()
out, err := json.MarshalIndent(testnetInfo, "", " ")
if err != nil {
return err
}
fmt.Println(string(out))
return nil
}

0 comments on commit ac4409d

Please sign in to comment.