Skip to content

Commit

Permalink
chore(agd testnet): Deprecate --v in favor of --validator-count, -n
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 authored and mhofman committed Feb 18, 2024
1 parent 70e5121 commit 2463df5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions golang/cosmos/daemon/cmd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (

var (
flagNodeDirPrefix = "node-dir-prefix"
flagNumValidators = "v"
flagNumValidators = "validator-count"
flagOutputDir = "output-dir"
flagNodeDaemonHome = "node-daemon-home"
flagStartingIPAddress = "starting-ip-address"
Expand All @@ -54,7 +54,7 @@ necessary files (private validator, genesis, config, etc.).
Note, strict routability for addresses is turned off in the config file.
Example:
agd testnet --v 4 --output-dir ./output --starting-ip-address 192.168.10.2
agd testnet -n 4 --output-dir ./output --starting-ip-address 192.168.10.2
`,
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
Expand All @@ -74,14 +74,25 @@ Example:
numValidators, _ := cmd.Flags().GetInt(flagNumValidators)
algo, _ := cmd.Flags().GetString(flags.FlagKeyAlgorithm)

if cmd.Flags().Changed("v") {
if cmd.Flags().Changed(flagNumValidators) {
return fmt.Errorf("--%s and --v are mutually exclusive", flagNumValidators)
}
numValidators, _ = cmd.Flags().GetInt("v")
}

return InitTestnet(
clientCtx, cmd, config, mbm, genBalIterator, outputDir, chainID, minGasPrices,
nodeDirPrefix, nodeDaemonHome, startingIPAddress, keyringBackend, algo, numValidators,
)
},
}

cmd.Flags().Int(flagNumValidators, 4, "Number of validators to initialize the testnet with")
cmd.Flags().IntP(flagNumValidators, "n", 4, "Number of validators to initialize the testnet with")
cmd.Flags().Int("v", 4, fmt.Sprintf("Alias for --%s", flagNumValidators))
if vFlag := cmd.Flags().Lookup("v"); vFlag != nil {
vFlag.Deprecated = fmt.Sprintf("use --%s", flagNumValidators)
}
cmd.Flags().StringP(flagOutputDir, "o", "./mytestnet", "Directory to store initialization data for the testnet")
cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix for the name of per-validator subdirectories (to be number-suffixed like node0, node1, ...)")
cmd.Flags().String(flagNodeDaemonHome, AppName, "Home directory of the node's daemon configuration")
Expand Down

0 comments on commit 2463df5

Please sign in to comment.