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

support "unknown command" for tx and query commands #310

Closed
4 tasks
colin-axner opened this issue Mar 6, 2020 · 3 comments · Fixed by #347
Closed
4 tasks

support "unknown command" for tx and query commands #310

colin-axner opened this issue Mar 6, 2020 · 3 comments · Fixed by #347

Comments

@colin-axner
Copy link
Contributor

Summary of Bug

Misuse of gaiacli tx and gaiacli query provide uninformative error reports as first reported in the sdk

Version

v2.0.6

Steps to Reproduce

gaiacli tx distr --from blabla
ERROR: unknown flag: --from
*because distr should be distribution

This can be fixed by adding

DisableFlagParsing:         true,
SuggestionsMinimumDistance: 2,
RunE:                       client.ValidateCmd,

to each command, alternatively I'm still tracking this pr which should fix some of these issues natively in cobra.

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@colin-axner
Copy link
Contributor Author

colin-axner commented Mar 6, 2020

ahh found another issue with ValidateCmd, this will catch the flag names from being added to suggested args, but it won't catch the flag arg from being added to suggested args, for example in the following:

gaiacli tx distribution --chain-id cosmoshub-3
ERROR: unknown command "cosmoshub-3" for "distribution"

I'd add a skipNext bool and if it is a flag under the condition arg[0] == "-" then set skipNext to true. At the beginning of the loop add a if skipNext { skipNext = false } and make the help if a elseif

edit: this doesn't work if the user does --flag=flagVal

@alexanderbez
Copy link
Contributor

Nice catch! Shouldn't this issue exist under the SDK?

@colin-axner
Copy link
Contributor Author

The first part I believe would be changed here and under tx cmd. The second comment should exist under the sdk, but I posted it here since I had just opened up a related issue

alessio pushed a commit that referenced this issue Apr 6, 2020
Add validation to the usage of the tx and query commands.

Closes: #310
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants