Change flag name from 'privnet' to 'json' in init command
@@ -13,12 +13,12 @@ import (
var (
testNet bool
- privateGenesis string
+ jsonGenesis string
)
func init() {
initGenesis.Flags().BoolVar(&testNet, "testnet", false, "create genesis block for Aergo TestNet")
- initGenesis.Flags().StringVar(&privateGenesis, "privnet", "", "genesis json file for private net")
+ initGenesis.Flags().StringVar(&jsonGenesis, "json", "", "genesis json file for private net")
rootCmd.AddCommand(initGenesis)
}
@@ -41,15 +41,15 @@ var initGenesis = &cobra.Command{
}
}
- if privateGenesis != "" {
+ if jsonGenesis != "" {
fmt.Println("create genesis block for PrivateNet")
- genesis = getGenesis(privateGenesis)
+ genesis = getGenesis(jsonGenesis)
if genesis == nil {
fmt.Printf("failed to obtain GenesisInfo\n")
return
}
if err := genesis.Validate(); err != nil {
- fmt.Printf(" %s (error:%s)\n", privateGenesis, err)
+ fmt.Printf(" %s (error:%s)\n", jsonGenesis, err)
return
}
}
@@ -76,15 +76,15 @@ var initGenesis = &cobra.Command{
}
func getGenesis(path string) *types.Genesis {
- file, err := os.Open(privateGenesis)
+ file, err := os.Open(jsonGenesis)
if err != nil {
- fmt.Printf("fail to open %s \n", privateGenesis)
+ fmt.Printf("fail to open %s \n", jsonGenesis)
return nil
}
defer file.Close()
genesis := new(types.Genesis)
if err := json.NewDecoder(file).Decode(genesis); err != nil {
- fmt.Printf("fail to deserialize %s (error:%s)\n", privateGenesis, err)
+ fmt.Printf("fail to deserialize %s (error:%s)\n", jsonGenesis, err)
return nil
}
return genesis
