25 lines
613 B
Bash
25 lines
613 B
Bash
|
#
|
||
|
# Hastebin pasting module
|
||
|
#
|
||
|
|
||
|
ZSPR_HASTEBIN_DOMANIN="https://paste.wut.ee"
|
||
|
|
||
|
function haste {
|
||
|
local file="${1}"
|
||
|
if [ ! -z "${file}" -o ! -t 0 ]; then
|
||
|
if [ ! -z "${file}" ]; then
|
||
|
local input="${file}"
|
||
|
else
|
||
|
local input="-"
|
||
|
fi
|
||
|
local output="$(cat "${input}" | curl -X POST --data-binary @- "${ZSPR_HASTEBIN_DOMANIN}/documents")"
|
||
|
echo -e "\n${ZSPR_HASTEBIN_DOMANIN}/$(echo "${output}" | jq -r .key)"
|
||
|
else
|
||
|
echo "Usage: haste [file]"
|
||
|
echo "haste can take input from stdin as well"
|
||
|
return 0
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
autoload -Uz haste
|