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 subcommands. #4284

Closed
4 tasks
npinto opened this issue May 6, 2019 · 1 comment · Fixed by #4465
Closed
4 tasks

Support "unknown command" for subcommands. #4284

npinto opened this issue May 6, 2019 · 1 comment · Fixed by #4465

Comments

@npinto
Copy link
Contributor

npinto commented May 6, 2019

Summary of Bug

gaiacli query distr comission --trust-node cosmos1234 returns the error ERROR: unknown flag: --trust-node which is misleading since the typo is from "commission". I believe it should lead to an error stating that comission is "unknown".

Version

cosmos-sdk: 0.34.3
git commit: 1127446f71fa6aeada1bce2718f7f903cc18e548
vendor hash: b0ee613acca9a3a572b558d0481ec7baa008f732431392af81db3555c92c8dd7
build tags: netgo ledger
go version go1.11.5 linux/amd64
cosmos@hgpu:~$ gaiacli version --long
cosmos-sdk: 0.34.3
git commit: 1127446f71fa6aeada1bce2718f7f903cc18e548
vendor hash: b0ee613acca9a3a572b558d0481ec7baa008f732431392af81db3555c92c8dd7
build tags: netgo ledger
go version go1.11.5 linux/amd64

Steps to Reproduce

gaiacli query distr comission --trust-node cosmos1234


For Admin Use

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

alexanderbez commented May 6, 2019

Thanks for creating an issue @npinto, but this is how cobra works by default. You can pass whatever you want as a command/argument:

https://github.com/spf13/cobra/blob/f619abc1d7edb30544d1c956719d203ace73e9b1/args.go#L9-L24

Looks like we need to come up with some sort of custom validation. Docker does this but idk how. I don't think this is a huge priority and would love some external contribution for this.

@alexanderbez alexanderbez changed the title "gaiacli query distr comission" returns a misleading error. Support "unknown command" for subcommands. May 6, 2019
alessio pushed a commit that referenced this issue Jun 4, 2019
Fixes #4284
Now prints:

gaiacli query distr comission --trust-node cosmos1234
ERROR: unknown command "comission" for "distr"

Did you mean this?
	commission

Adds custom argument validation for subcommands with subcommands. Doesn't affect "query" or "tx" subcommands since they reside in gaia repo. All flags except help are disabled for these commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants