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

Turn --from into a positional argument in gaiacli tx send #4142

Closed
4 tasks
alessio opened this issue Apr 17, 2019 · 3 comments · Fixed by #4146
Closed
4 tasks

Turn --from into a positional argument in gaiacli tx send #4142

alessio opened this issue Apr 17, 2019 · 3 comments · Fixed by #4146

Comments

@alessio
Copy link
Contributor

alessio commented Apr 17, 2019

Kind of related to: #4072

The gaiacli tx send command's --from flag carries a required parameter. As such it should be a positional argument rather than a required flag. Marking a flag required is usually a good sign that such parameter should be passed as a positional argument.

Positional arguments are inherently required as they represent inputs without which the command cannot operate. Conversely, flags are traditionally used to modify a command behaviour and are innatum optional.

Description

As A user of gaiacli
I Want to broadcast/generate a send tx with gaiacli tx send
So That I can broadcast a tx/generate a specimen of a tx.

Acceptance Criteria

AC1

Given I can access my key foo in the local keybase
When I run gaiacli tx send foo to_address amount
Then a send tx (from: foo's address; to: to_address address; amount: amount) is generated and broadcast to a node for further validation/processing.

AC2

Given I have no access to the local keybase
When I run gaiacli tx send --generate-only from_address to_address amount
Then a send tx (from: foo_address; to: to_address; amount: amount) specimen is generated and printed out to screen.


For Admin Use

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

alexanderbez commented Apr 17, 2019

Thanks @alessio

  1. Shouldn't the AC state that all commands be updated to reflect this, not just tx send?
  2. Commands like tx send are gonna get ugly IMHO. eg. tx send <from-addr> <to-addr> <amount> can easily be screwed up.

I also want to bring to light where this notion of "required flags must be positional arguments". Imho, this is not some universal axiom -- it is very much command and context dependent. IMHO, this really only applies to very simple and short commands.

@alexanderbez alexanderbez added C:CLI S:proposed T: Dev UX UX for SDK developers (i.e. how to call our code) T: UX and removed T: Dev UX UX for SDK developers (i.e. how to call our code) labels Apr 17, 2019
@alessio
Copy link
Contributor Author

alessio commented Apr 17, 2019

Shouldn't the AC state that all commands be updated to reflect this, not just tx send?

This is just for tx send. Other commands will be addressed at a later stage.

Commands like tx send are gonna get ugly IMHO. eg. tx send can easily be screwed up.
[snip]
I also want to bring to light where this notion of "required flags must be positional arguments". Imho, this is not some universal axiom

Indeed it is not, in fact it's not a bad practice at all to turn positional arguments into options, should the program command line require too many arguments. In that case yes, I'd agree to turn some into optional arguments.
In other words, I did not intend to put forward a universally valid case in favour of replacing flags with arguments; it is worth noting that conventionally required inputs should be positional arguments rather than optional ones (e.g. [1])

this really only applies to very simple and short commands.

In my view, tx send most definitely qualifies as such. Let's take into consideration the following two examples. Which one does sound more natural to you?

1:

gaiacli tx send FROM TO AMOUNT

2:

gaiacli tx send --from=FROM TO AMOUNT

Semantically speaking, from users perspective gaiacli tx send means very simply X send to Y N coins. The main purpose of it is then transferring coins from one end to another - fees, gas, output formatting options et similia are additional side information.

In this case enforcing a shorter, strictly positional syntax makes things clearer and encourages a less error-prone usage.

@alessio
Copy link
Contributor Author

alessio commented Apr 17, 2019

This is a very small task. Hence estimating as 1 point.

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