dotfiles/.local/bin/scripts/void
2025-02-04 11:57:49 +01:00

15 lines
508 B
Bash
Executable file

#!/bin/sh
#temp=$(mktemp)
target=$(pass app/voidcat)
for arg; do
extension=$(echo "$arg" | sed 's/.*\.//')
echo "Uploading $arg"
{ curl --progress-bar -X POST \
-H "V-Content-Type: $(file --mime-type -b $1)" \
-H "V-Full-Digest: $(sha256sum -bz $1 | cut -d' ' -f1)" \
-H "V-Filename: $arg" \
-H "Authorization: Bearer $(echo "$target" | head -1)" \
--data-binary @$arg \
$(echo "$target" | tail -1); echo; } | sed "s/\$/.$extension/"
done
#test $# -gt 1 && echo && #sed 's|http:|https:|' "$temp"