-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8678 from Agoric/gibson-2023-12-golang-cli-commands
style(golang): Align CLI command fields with upstream recommendations
- Loading branch information
Showing
5 changed files
with
55 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
|
@@ -48,13 +48,13 @@ func testnetCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalance | |
cmd := &cobra.Command{ | ||
Use: "testnet", | ||
Short: fmt.Sprintf("Initialize files for a %s testnet", AppName), | ||
Long: `testnet will create "v" number of directories and populate each with | ||
Long: `testnet will create one directory per validator and populate each with | ||
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) | ||
|
@@ -74,16 +74,27 @@ 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 the directory name for each node with (node results in node0, node1, ...)") | ||
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") | ||
cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list [email protected]:46656, [email protected]:46656, ...)") | ||
cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters