2018-07-25 19:13:05 -04:00
|
|
|
#!/bin/zsh
|
|
|
|
|
|
|
|
upload() {
|
2018-08-03 01:41:32 -04:00
|
|
|
http --check-status --ignore-stdin --form \
|
2018-07-25 19:13:05 -04:00
|
|
|
POST https://up.00dani.me/ \
|
|
|
|
Authorization:$UP_TOKEN \
|
2018-08-03 01:41:32 -04:00
|
|
|
file@$1
|
2018-07-25 19:13:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (( $# == 0 )); then
|
|
|
|
upload =(cat)
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
|
|
|
for f; do
|
|
|
|
if [[ ! -r $f ]]; then
|
|
|
|
print "up: $f is not a readable file" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
upload $f || exit $?
|
|
|
|
print
|
|
|
|
done
|