bin/contrib/cli/client
Leonora Tindall cac483b99f
Rebrand the client to NoraCodes (#5)
* NoraCodes branding in /r/client

* Bump noracodes fork version
2023-03-01 15:37:38 -06:00

22 lines
467 B
Bash
Executable file

#!/bin/bash
# Install by:
# $ curl -o pst https://bin.nora.codes/client && chmod +x pst
#
# Usage:
# $ pst somefile.txt
# $ cat someimage.png | pst
# Change the url accordingly
URL="https://bin.nora.codes"
FILEPATH="$1"
FILENAME=$(basename -- "$FILEPATH")
EXTENSION="${FILENAME##*.}"
RESPONSE=$(curl --data-binary @${FILEPATH:-/dev/stdin} --url $URL)
PASTELINK="$URL$RESPONSE"
[ -z "$EXTENSION" ] && \
echo "$PASTELINK" || \
echo "$PASTELINK.$EXTENSION"