cli
cli copied to clipboard
Improve CLI usability (positional arguments order)
Either allow request items to be specified before URL or improve the error message.
https://twitter.com/akrabat/status/488285985672019968
Positional arguments:
- The URL argument is the first positional one. It’s the only required argument.
- After that, other positional arguments—request items—may optionally follow.
Arguments order:
- If we allow random order of the positional arguments, then we’d have to introduce a detection for which of the arguments represent the URL. We can no longer rely on it being first.
- This might be doable, but there’ll be a bunch of edge cases where it’s not straightforward or impossible, for example, the one below.
- Detecting a request item type easy, because they differ in the separator used.
# An example of an ambiguous random-order positional argument set:
$ http pie.dev/post httpie.io/a=a
^^^^^^^^^^^^ ^^^^^^^^^^^^^^
Valid URL Both valid URL & data field
Can I take up this issue??...... Is it still open??
I don’t think REQUEST_ITEM
s need to be allowed to come before the URL
but it sure would be great if the --
-prefixed options would be allowed everywhere.
Specifically, I often need to switch the HTTP verb. The fact that it cannot be simply added after http
but instead needs to be inserted between the last option and the URL, makes it difficult to edit an existing command.
I.e. allow http post --auth admin
in addition to http --auth admin post
.
While we’re at it, a shorthand for --verify=no
would also be appreciated.
EDIT: See #125 and #1536