Skip to content
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 3 commits into from
Jan 19, 2024

Conversation

gibson042
Copy link
Member

@gibson042 gibson042 commented Dec 20, 2023

Description

cf. https://pkg.go.dev/github.com/spf13/cobra#Command and https://github.com/spf13/cobra/blob/v1.8.0/site/content/user_guide.md#example
Only optional arguments should be wrapped in square brackets, alternatives should be wrapped in curly braces, and Long strings should generally start similar to Use.

Security Considerations

n/a

Scaling Considerations

n/a

Documentation Considerations

This improves self-documentation of CLI commands, reducing the need for external digging.

Testing Considerations

n/a

Upgrade Considerations

Deprecation of agd testnet --v may result in some noise, but no change in actual behavior.

Copy link
Member

@michaelfig michaelfig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! As usual, my approval is based on addressing comments to your satisfaction.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is copied directly from the upstream genaccounts.go. Would you please also make a PR against that file so that your changes benefit the Cosmos as a whole?

Copy link
Member

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.

golang/cosmos/daemon/cmd/testnet.go Outdated Show resolved Hide resolved
golang/cosmos/x/swingset/client/cli/tx.go Outdated Show resolved Hide resolved
golang/cosmos/x/swingset/client/cli/tx.go Outdated Show resolved Hide resolved
func NewCmdSubmitCoreEvalProposal() *cobra.Command {
cmd := &cobra.Command{
Use: "swingset-core-eval [[permit.json] [code.js]]...",
Use: "swingset-core-eval <permit.json code.js>...",
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

@JimLarson JimLarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving - but only to avoid needing to come back to me. I second mfig's requests and have a self-contained request that I trust you to respond to.

Use: "deliver [json string]",
Short: "deliver inbound messages",
Args: cobra.ExactArgs(1),
Use: "deliver {<messages JSON> | @- | @<file path>}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what a "messages JSON" is, as opposed to just a "JSON". Explain what @- does in the long description. Each command needs to either be self-contained or have an explicit reference to conventions that can be found somewhere else.

@gibson042 gibson042 force-pushed the gibson-2023-12-golang-cli-commands branch from f7b96ae to 0887645 Compare January 19, 2024 15:28
@gibson042 gibson042 added the automerge:rebase Automatically rebase updates, then merge label Jan 19, 2024
@mergify mergify bot merged commit 853cca5 into master Jan 19, 2024
74 checks passed
@mergify mergify bot deleted the gibson-2023-12-golang-cli-commands branch January 19, 2024 15:59
mhofman pushed a commit that referenced this pull request Feb 18, 2024
style(golang): Align CLI command fields with upstream recommendations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants