-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
cmd: Implement httpie plugins interface #1200
Conversation
The testing bit took a lot more than I thought, but I think it worths it (since it simplifies workflow by a lot). Now focusing on docs / remaining smaller tests. |
Codecov Report
@@ Coverage Diff @@
## master #1200 +/- ##
==========================================
- Coverage 97.28% 96.68% -0.60%
==========================================
Files 67 78 +11
Lines 4235 5158 +923
==========================================
+ Hits 4120 4987 +867
- Misses 115 171 +56
Continue to review full report at Codecov.
|
74d10e0
to
ed4425e
Compare
I'll take a look at the package builds at last, but I feel like it should be easy to resolve. |
3f332e1
to
e82fe74
Compare
I think I need to send a pull request to https://src.fedoraproject.org/rpms/httpie/blob/rawhide/f/httpie.spec after this gets merged since packit uses that file for the package configuration. |
9a12a52
to
e82fe74
Compare
e82fe74
to
70c44d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m yet to dive to the nitty-gritty, but overall it looks pretty solid 👍🏻
One thing we should definitely improve though is the UX of when the management httpie
command gets invoked without args or with invalid args:
The thing is that many people (my guess would be ~50%+, i.e., higher thousands a month) will, after running x install httpie
, run httpie
.
We need to anticipate that and give them a crystal clear indication about the command/project name mismatch and help them get towards sending their first request; the mismatch is highly unintuitive. (The docs could also be more clear in this sense.) And the ability to direct people to the correct command is actually an extremely valuable side-benefit of the new httpie
command.
The default argparse
output is not helpful in this sense at all:
$ httpie
usage: httpie [-h] [--debug] [--traceback] {plugins} ...
httpie: error: please specify one of these: 'plugins'
We should also handle the following scenario. Here we could print the same as above, but also print the correct command (http POST pie.dev/post hello=world
) so that the user can just copy/paste/re-run it with the correct command name this time:
$ httpie POST pie.dev/post hello=world
usage: httpie [-h] [--debug] [--traceback] {plugins} ...
httpie: error: argument action: invalid choice: 'POST' (choose from 'plugins')
This is slightly better:
$ httpie --help
usage: httpie [-h] [--debug] [--traceback] {plugins} ...
Managing interface for the HTTPie itself. <https://httpie.io/docs#manager>
Be aware that you might be looking for http/https commands for sending
HTTP requests. This command is only available for managing the HTTTPie
plugins and the configuration around it.
positional arguments:
{plugins}
optional arguments:
-h, --help
show this help message and exit
--debug
Prints the exception traceback should one occur, as well as other
information useful for debugging HTTPie itself and for reporting bugs.
--traceback
Prints the exception traceback should one occur.
@jakubroztocil I've implemented 2 different suggestions. First one is when you simply run $ httpie 1,021s
usage: httpie [-h] [--debug] [--traceback] {plugins} ...
httpie: error: Please specify one of these: "plugins"
This command is for managing HTTPie plugins.
Perhaps you are looking for http/https commands, e.g:
http POST pie.dev/post hello=world
It gives the actual description / error message, but also mentions about
We try to parse the arguments as if it was parsed by |
@isidentical thanks. I’ll play with it and tweak the copy a bit more. We got a failing test it seems: https://github.com/httpie/httpie/runs/4322055556?check_suite_focus=true#step:5:226 |
Yep, seems like the API I depend on is only available 3.9+. Trying to overcome that at the moment. |
1e46b9f
to
241f560
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments, I am new to this lib (as a dev) so not really sure whether some of my comments are against the design.
833e928
to
267879e
Compare
267879e
to
042e46c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few last comments. Let’s merge it afterward, and we can always continue to polish in master
🚀
Resolves #566.
Remaining stuff: