diff options
| author | 2019-03-22 01:22:25 -0400 | |
|---|---|---|
| committer | 2019-03-22 01:22:25 -0400 | |
| commit | 478535b0c4fbb077ddd7f46a992176a211a666ce (patch) | |
| tree | 676d014c6dc5933d87b74e4cf483813adbeb6f2b | |
| parent | [client] Update anypaste plugin (diff) | |
[client] Update shell script/sourceable
| -rwxr-xr-x | client/brpaste.sh | 8 |
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 "$@" |
