Skip to content

Commit

Permalink
Update init.go
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy authored Jan 17, 2024
1 parent df35d14 commit 8133303
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions cmd/daemon/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,29 @@ import (
"github.com/spf13/cobra"
)

// buildInitCmd builds a sub-command to initialized the Pactus blockchain node.
// buildInitCmd builds a sub-command to initialize the Pactus blockchain node.
func buildInitCmd(parentCmd *cobra.Command) {
initCmd := &cobra.Command{
Use: "init",
Short: "Initialize the Pactus blockchain node",
}
parentCmd.AddCommand(initCmd)
workingDirOpt := initCmd.Flags().StringP("working-dir", "w",
cmd.PactusDefaultHomeDir(), "A path to the working directory to save the wallet and node files")
cmd.PactusDefaultHomeDir(), "the path to the working directory to save the wallet and node files")

testnetOpt := initCmd.Flags().Bool("testnet", true,
"Initialize working directory for joining the testnet") // TODO: make it false after mainnet launch
"initialize working directory for joining the testnet") // TODO: make it false after mainnet launch

localnetOpt := initCmd.Flags().Bool("localnet", false,
"Initialize working directory for localnet (for developers)")
"initialize working directory for localnet for developers")

restoreOpt := initCmd.Flags().String("restore", "", "Restore the default_wallet using a mnemonic (seed phrase)")
restoreOpt := initCmd.Flags().String("restore", "", "restore the 'default_wallet' using a mnemonic or seed phrase")

passwordOpt := initCmd.Flags().StringP("password", "p", "", "wallet password")
passwordOpt := initCmd.Flags().StringP("password", "p", "", "the wallet password")

entropyOpt := initCmd.Flags().IntP("entropy", "e", 128, "entropy for seed generation, 128 (12 pass phrase) is default")
entropyOpt := initCmd.Flags().IntP("entropy", "e", 128, "entropy bits for seed generation. range: 128 to 256")

valNumOpt := initCmd.Flags().IntP("val-num", "", 7, "number of validator(s) to be created,"+
"default 7, minimum 1, maximum 32")
valNumOpt := initCmd.Flags().IntP("val-num", "", 0, "number of validators to be created. range: 1 to 32")

initCmd.Run = func(_ *cobra.Command, _ []string) {
workingDir, _ := filepath.Abs(*workingDirOpt)
Expand All @@ -49,7 +48,7 @@ func buildInitCmd(parentCmd *cobra.Command) {
cmd.PrintInfoMsgf("Your wallet seed is:")
cmd.PrintInfoMsgBoldf(" " + mnemonic)
cmd.PrintLine()
cmd.PrintWarnMsgf("Write down this seed on a piece of paper to recover your validator key in future.")
cmd.PrintWarnMsgf("Write down this seed on a piece of paper to recover your validator key in the future.")
cmd.PrintLine()
confirmed := cmd.PromptConfirm("Do you want to continue")
if !confirmed {
Expand Down

0 comments on commit 8133303

Please sign in to comment.