summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-12-19 13:01:18 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-12-19 13:01:18 +0100
commit4b37c70dffaa17305e9b2686bc87265012b28bfd (patch)
treed20da000deabe9427757cd9d0923bbb9ab9418af
parent1b50c5498c5e7502e89fb86c282956c91eb42c46 (diff)
up: Switch to Andy from Sh
-rwxr-xr-x.local/bin/up34
1 files changed, 18 insertions, 16 deletions
diff --git a/.local/bin/up b/.local/bin/up
index 9ef9ae0..71da6b5 100755
--- a/.local/bin/up
+++ b/.local/bin/up
@@ -1,21 +1,23 @@
-#!/bin/sh
+#!/usr/local/bin/andy
-set -e
-
-upload()
-{
- local f="$1"
- [ $1 = '-' ] && f=/dev/stdin
- curl --retry-all-errors -X POST -H "Authorization: $TOKEN" -F "data=@$f" \
+func upload file {
+ if test $file = '-' {
+ set file /dev/stdin
+ }
+ curl (
+ --retry-all-errors
+ -X POST
+ -H "Authorization: $TOKEN"
+ -F "data=@$file"
https://paste.thomasvoss.com
+ )
}
-readonly TOKEN=`vlt raw Miscellaneous 'Mpaste (Key)'`
-
-[ $# -eq 0 ] && upload -
-for f in "$@"
-do
- upload "$f" &
-done
-
+set TOKEN `vlt raw Miscellaneous 'Mpaste (Key)'
+if test $#args -lt 2 {
+ set args $args -
+}
+for $args[1..] {
+ async upload $_
+}
wait