-
Notifications
You must be signed in to change notification settings - Fork 6
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
Feature: curl --write-out support #50
Comments
I was searching if it is possible to have a wrapper around this custom output, so that the plugin can maybe detect it in some way (maybe a treesitter token?). curl -s -w "\n<custom>%{time_total}\n%{time_redirect}</custom>" -XGET https://jsonplaceholder.typicode.com/todos which results in the following output [
{
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
},
{
"userId": 1,
"id": 2,
"title": "quis ut nam facilis et officia qui",
"completed": false
}
]
<custom>1.147859
0.000000</custom> |
Great idea, I did not know about this feature! I'll play around with it a little and see if I can come up with a nice solution. |
oysandvik94
added a commit
that referenced
this issue
Sep 26, 2024
Related to #50 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/oysandvik94/curl.nvim/issues/50?shareId=XXXX-XXXX-XXXX-XXXX).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Curls man page defines an option called
--write-out
which you can use to output in custom formats.Ussually, I use this feature to get the request/response times, debug ssl, redirects etc.
The formats can be specified either inline in the command like this
curl -w "%{total_time}" https://example.com
or in a different file like followingand use it in the command like so
curl -w "@curl-filename.txt"
Right now, it is somewhat possible to do this, as it is just a flag for curl.
But the output looses its format. I assume that this is because of jq
eg:
you could do this request
This will give the results in a single line, with the custom format at the end of it
I think it would be great if the plugin had explicit support for this.
That is, users can define a format file (or an inline format) in the config, or the plugin detects the
-w
flag in the curl file,and outputs the formatted result ,maybe in the top of the output buffer, just like how headers are shown for the
-i
flag.The text was updated successfully, but these errors were encountered: