summaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rwxr-xr-xclient/brpaste.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/client/brpaste.sh b/client/brpaste.sh
index 97bd697..0e3dbce 100755
--- a/client/brpaste.sh
+++ b/client/brpaste.sh
@@ -1,8 +1,10 @@
#!/bin/sh
brpaste() {
host='https://brpaste.xyz'
- out=$(curl -sF 'data=<-' $host || printf fail)
- [ "$out" = fail ] && echo fail || printf '%s/%s\n' "$host" "$out"
+ [ $# -eq 0 ] && set -- '-'
+ brpaste_id=$(curl -#fF "data=<$1" "$host") \
+ || { echo 'ERROR: Upload failed!' >&2 && exit 1; }
+ printf '%s/%s\n' "$host" "$brpaste_id"
}
-brpaste
+return 0 2>/dev/null || brpaste "$@"