Add up, a handy little script for uploading a file or three to up.00dani.me
This commit is contained in:
parent
adbab7baa0
commit
19b8f350cf
1 changed files with 24 additions and 0 deletions
24
local/bin/up
Executable file
24
local/bin/up
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/zsh
|
||||
|
||||
upload() {
|
||||
http --check-status --ignore-stdin \
|
||||
POST https://up.00dani.me/ \
|
||||
Authorization:$UP_TOKEN \
|
||||
Content-Type:$(file --mime-type -b $1) \
|
||||
X-Filename:$1 \
|
||||
@$1
|
||||
}
|
||||
|
||||
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
|
Loading…
Reference in a new issue