changelog/hooks-content/hastebin.sh
2020-05-15 09:46:56 +00:00

17 lines
459 B
Bash

#!/bin/bash
HOOKS_CONTENT+=( hookContentHastebin )
HASTEBIN_SERVER=https://paste.interhacker.space
hookContentHastebin(){
[[ -z "$1" ]] && echo "Store a file by name in pastebin" && return
TMP="$1"
read -e -p "File location? " FILE
[[ ! -f $FILE ]] && panic "Not a valid file" && exit
URL=$( curl -X POST -s -d "$(cat "$FILE" )" "$HASTEBIN_SERVER/documents" | awk -F '"' '{print "'$HASTEBIN_SERVER'/raw/"$4}'; )
echo "$FILE: $URL" >> $TMP
}