Document: How to paste from stdin
pinpox opened this issue ยท 1 comments
pinpox commented
Hey ๐
I mostly use pastebins when debugging sysemtems to quickly paste logs somewhere to share with coworkers. I used to have a different pastebin which allowed to do something like this:
cat error.log | pastebin-script
Which would paste that text from stdin and print a url with the created past. Is it possible to create such a command for wastebin with curl?
I saw the example for clipboards at https://github.com/matze/wastebin?tab=readme-ov-file#paste-from-clipboard but that is exactly what I need and I have not yet figured out how to make it work.
Maybe you already know how to create an alias or script for this and could document it.
pinpox commented
Answering my own question:
This bash function allows pasting by doing cat file.txt | paste
:
paste() {
jq -Rns '{text: inputs}' | curl -s -H 'Content-Type: application/json' \
--data-binary @- https://wastebin.tld | jq -r '. | "wastebin.tld\(.path)"'
}