curl / trurl

trurl is a command line tool for URL parsing and manipulation.
https://curl.se/trurl/
Other
3.1k stars 99 forks source link

Allow trurl to read from stdin using pipes. #277

Closed jacobmealey closed 5 months ago

jacobmealey commented 5 months ago

This adds the ability to use pipes to read from stdin. Note that this keeps the -f - style as is, but can be removed if folks want that. Example usage:

$ echo "www.google.com" | trurl 
http://www.google.com/
$ cat someurls.txt | trurl --get "{scheme}"
https
https
git
http
ftp
$ (trurl -s query="foo=bar") < someurls.txt
https://curl.se/?foobar
https://docs.python.org/?foobar
git://github.com/curl/curl.git?foobar

fixes #275

jacobmealey commented 5 months ago

Okay, it took an embarrassingly long time to figure out why it was failing. turns out github runners do weird things with standard in, but made some more bugs visible. Anyway, it should be all good now.

jacobmealey commented 5 months ago

okay something is busted on the tests runners in a way im not sure how to reproduce locally (they run fine on both my mac and linux machines). I'm gonna close this PR and rethink how to do these tests.