summaryrefslogtreecommitdiffstats
path: root/util/bin/paste
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-05-16 21:01:42 +0200
committerlassulus <lass@aidsballs.de>2015-05-16 21:01:42 +0200
commita6870c5588c45a13359c26744ffb38a5ad88742f (patch)
tree4c3beec02b7646557c1fd49aa816ee2d37091510 /util/bin/paste
parent0358f6cd6c5b4eb94ee804bfad47f07e0a6e661c (diff)
util/bin: add paste (pastes to pastebin services)
Diffstat (limited to 'util/bin/paste')
-rwxr-xr-xutil/bin/paste26
1 files changed, 26 insertions, 0 deletions
diff --git a/util/bin/paste b/util/bin/paste
new file mode 100755
index 00000000..be29c78f
--- /dev/null
+++ b/util/bin/paste
@@ -0,0 +1,26 @@
+#!/bin/sh
+set -euf
+
+usage() {
+ echo 'paste reads from stdin and pastes to the specified paste service'
+ echo 'currently ix.io and paste.retiolum are supported'
+ echo 'default is paste.retiolum'
+ echo 'ex:'
+ echo 'cat somefile | paste ix.io'
+}
+
+hoster=${1:-paste.retiolum}
+
+case $hoster in
+ paste.retiolum|paste)
+ curl -sS -F 'file=@-;type=text/plain' \
+ http://paste.retiolum:5000/+upload \
+ | sed -n 's|.*href="\([^"]*\).*|http://paste.retiolum\1\n|p'
+ ;;
+ ix.io)
+ curl -sS -F 'f:1=<-' ix.io
+ ;;
+ *)
+ usage
+ ;;
+esac