dotfiles/.local/bin/pst

16 lines
373 B
Plaintext
Raw Normal View History

#!/bin/sh
url="https://bin.xstefen.dev"
filepath="$1"
filename=$(basename -- "$filepath")
extension="${filename##*.}"
response=$(curl --data-binary @${filepath:-/dev/stdin} --url $url)
#echo "$url$response"".""$extension" | tee >(xclip -selection clipboard)
pastelink="$url$response"
[ -z "$extension" ] && \
echo "$pastelink" || \
echo "$pastelink.$extension"