summaryrefslogtreecommitdiff
path: root/.local/bin/up
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-10-28 14:50:29 +0200
committerThomas Voss <mail@thomasvoss.com> 2023-10-28 14:50:29 +0200
commit0adb3ef91a8384cc66fc21052d0370581c3b1b0f (patch)
treea44e337d8c91e27a96957f6bdf6b02096b1efff2 /.local/bin/up
parent0846e042ba5788b5ec3fd7c43a820fe3b5130d14 (diff)
up: Add the up script
Diffstat (limited to '.local/bin/up')
-rwxr-xr-x.local/bin/up21
1 files changed, 21 insertions, 0 deletions
diff --git a/.local/bin/up b/.local/bin/up
new file mode 100755
index 0000000..9ef9ae0
--- /dev/null
+++ b/.local/bin/up
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+upload()
+{
+ local f="$1"
+ [ $1 = '-' ] && f=/dev/stdin
+ curl --retry-all-errors -X POST -H "Authorization: $TOKEN" -F "data=@$f" \
+ https://paste.thomasvoss.com
+}
+
+readonly TOKEN=`vlt raw Miscellaneous 'Mpaste (Key)'`
+
+[ $# -eq 0 ] && upload -
+for f in "$@"
+do
+ upload "$f" &
+done
+
+wait