-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
style(golang): Align CLI command fields with upstream recommendations #8678
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
f3ca924
style(golang): Align CLI command fields with upstream recommendations
gibson042 90f4ba8
chore(agd testnet): Deprecate --v in favor of --validator-count, -n
gibson042 0887645
chore(x/swingset): Adopt and explain conventions for file/inline CLI …
gibson042 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,11 +44,18 @@ func GetTxCmd(storeKey string) *cobra.Command { | |
} | ||
|
||
// GetCmdDeliver is the CLI command for sending a DeliverInbound transaction | ||
// containing mailbox messages. | ||
func GetCmdDeliver() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "deliver [json string]", | ||
Short: "deliver inbound messages", | ||
Args: cobra.ExactArgs(1), | ||
Use: "deliver {<messages JSON> | @- | @<file>}", | ||
Short: "send mailbox messages", | ||
Long: `send mailbox messages. | ||
The argument indicates how to read input JSON ("@-" for standard input, | ||
"@..." for a file path, and otherwise directly as in "deliver '[...]'"). | ||
Input must represent an array in which the first element is an array of | ||
[messageNum: integer, messageBody: string] pairs and the second element | ||
is an "Ack" integer.`, | ||
Args: cobra.ExactArgs(1), | ||
|
||
RunE: func(cmd *cobra.Command, args []string) error { | ||
cctx, err := client.GetClientTxContext(cmd) | ||
|
@@ -91,7 +98,14 @@ func GetCmdDeliver() *cobra.Command { | |
// InstallBundle message in a transaction. | ||
func GetCmdInstallBundle() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "install-bundle <JSON>/@<FILE>/-", | ||
Use: "install-bundle {<bundle JSON> | @- | @<file>}", | ||
Short: "install a bundle", | ||
Long: `install a bundle. | ||
The argument indicates how to read input JSON ("@-" for standard input, | ||
"@..." for a file path, and otherwise directly as in | ||
"install-bundle '{...}'"). | ||
Input should be endoZipBase64 JSON, but this is not verified. | ||
https://github.com/endojs/endo/tree/master/packages/bundle-source`, | ||
Args: cobra.ExactArgs(1), | ||
|
||
RunE: func(cmd *cobra.Command, args []string) error { | ||
|
@@ -147,7 +161,7 @@ func GetCmdInstallBundle() *cobra.Command { | |
// GetCmdProvision is the CLI command for sending a Provision transaction | ||
func GetCmdProvisionOne() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "provision-one [nickname] [address] [power-flags]", | ||
Use: "provision-one <nickname> <address> [<power-flag>[,...]]", | ||
Short: "provision a single address", | ||
Args: cobra.RangeArgs(2, 3), | ||
|
||
|
@@ -185,7 +199,7 @@ func GetCmdProvisionOne() *cobra.Command { | |
// GetCmdWalletAction is the CLI command for sending a WalletAction or WalletSpendAction transaction | ||
func GetCmdWalletAction() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "wallet-action [json string]", | ||
Use: "wallet-action <action JSON>", | ||
Short: "perform a wallet action", | ||
Args: cobra.ExactArgs(1), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
|
@@ -220,9 +234,11 @@ func GetCmdWalletAction() *cobra.Command { | |
return cmd | ||
} | ||
|
||
// NewCmdSubmitCoreEvalProposal is the CLI command for submitting a "CoreEval" | ||
// governance proposal via `agd tx gov submit-proposal swingset-core-eval ...`. | ||
func NewCmdSubmitCoreEvalProposal() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "swingset-core-eval [[permit.json] [code.js]]...", | ||
Use: "swingset-core-eval <permit.json code.js>...", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure of the correct placement of angle brackets to indicate that these are pairs of filenames. Your rendition seems okay, but I wish there was something even clearer. |
||
Args: cobra.MinimumNArgs(2), | ||
Short: "Submit a proposal to evaluate code in the SwingSet core", | ||
Long: `Submit a SwingSet evaluate core Compartment code proposal along with an initial deposit. | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a copy of another upstream file, testnet.go.