Cosmos-sdk: gaiacli send: Make malformed command provide an example command

Created on 13 Jun 2018  路  6Comments  路  Source: cosmos/cosmos-sdk

For example:

$ gaiacli send 
ERROR: must provide a from address name
$ gaiacli send --name=dev
ERROR: unknown flag: --from

I think it would be useful if the error message for each of these had an additional line showing the usage:
sample usage: gaiacli send --amount=1steak --chain-id=<chain-id> --name=<key_name> --to=<destination_address>
I think this makes sense to do for syntax errors, to avoid making the user have to resort to going to the help for the correct flag. It would also be really cool if this could also autocomplete based on a few of the parameters sent. I.e.

$ gaiacli send --name=dev --amount=5steak --chain-id=cool_testnet
ERROR: unknown flag: --from
sample usage: gaiacli send --amount=5steak --chain-id=cool_testnet --name=<key_name> --to=<destination_address>

As a side note, I think would be helpful to alias the --name flag with --from, since that seemed to be the intuitive response for me.

CLI good first issue help wanted proposal

Most helpful comment

That would be cool! However it should only prompt for fields not entered, so that if I enter all default fields it has no prompts. (For speed for experienced users / ease of scripting)

Agreed - only prompt if not provided.

I'm not sure if we want to go down the route of making all commands interactive though. I definitely prefer most commands that I use being non-interactive especially when there are lots of optional small flags, but that is just personal preference. (Setup commands excluded)

How about -i / --interactive to prompt for any arguments where not provided, and usual operation otherwise?

All 6 comments

Perhaps better yet, we could prompt the user to enter the argument (https://github.com/cosmos/cosmos-sdk/issues/1177).

That would be cool! However it should only prompt for fields not entered, so that if I enter all default fields it has no prompts. (For speed for experienced users / ease of scripting)

I'm not sure if we want to go down the route of making all commands interactive though. I definitely prefer most commands that I use being non-interactive especially when there are lots of optional small flags, but that is just personal preference. (Setup commands excluded)

That would be cool! However it should only prompt for fields not entered, so that if I enter all default fields it has no prompts. (For speed for experienced users / ease of scripting)

Agreed - only prompt if not provided.

I'm not sure if we want to go down the route of making all commands interactive though. I definitely prefer most commands that I use being non-interactive especially when there are lots of optional small flags, but that is just personal preference. (Setup commands excluded)

How about -i / --interactive to prompt for any arguments where not provided, and usual operation otherwise?

That sounds great to me!

Nice! - great idea

I think the scope here, including the discussion is better covered by #1177 and #693 closing this in favor of those issues.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ValarDragon picture ValarDragon  路  3Comments

rigelrozanski picture rigelrozanski  路  3Comments

fedekunze picture fedekunze  路  3Comments

rigelrozanski picture rigelrozanski  路  3Comments

ValarDragon picture ValarDragon  路  3Comments