1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
# ----------------------------------------------------------------------------
# http://hastebin.com/
# Gera link para arquivos de texto em geral.
#
# Uso: zzhastebin [arquivo]
# Ex.: zzhastebin helloworld.sh
#
# Autor: Jones Dias <diasjones07 (a) gmail.com>
# Desde: 2015-02-12
# Versão: 1
# Licença: GPL
# ----------------------------------------------------------------------------
# DESATIVADA: 2018-01-27 curl falha, precisa do haste (ruby e xcode)
zzhastebin ()
{
zzzz -h hastebin "$1" && return
test -n "$1" || { zztool -e uso hastebin; return 1; }
# Verifica o parametro da função
zztool arquivo_legivel "$1" || { zztool -e uso hastebin; return 1; }
local hst="http://hastebin.com/"
local uri
local ext=$(basename $1 | cut -d\. -f2)
# Retorna o ID
uri="$(curl -s --data-binary @$1 ${hst}documents | cut -d\" -f 4)"
# Imprime link
echo "$hst$uri.$ext"
}
|