Add puttmpninja
This commit is contained in:
parent
fb96c52966
commit
4f3050e401
7
.config/zsh/completions/_puttmpninja
Normal file
7
.config/zsh/completions/_puttmpninja
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#compdef puttmpninja
|
||||||
|
|
||||||
|
_arguments '-h[short help text]' '*:file:_files'
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# End:
|
20
.config/zsh/functions/puttmpninja
Executable file
20
.config/zsh/functions/puttmpninja
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
# Put files on a tmp.ninja
|
||||||
|
|
||||||
|
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
|
||||||
|
|
||||||
|
zmodload zsh/zutil
|
||||||
|
local -a o_help=()
|
||||||
|
zparseopts -D -K -- h=o_help
|
||||||
|
if [[ ${#o_help} -ne 0 || ! -v 1 ]]; then
|
||||||
|
ret=$(( ${#o_help} ^ 1 ))
|
||||||
|
print -u $(( 1 + ${ret} )) -l "usage: ${0} [-h] <FILE> …" \
|
||||||
|
"\e[3mFiles on tmp.ninja expire after 48 hours.\e[0m"
|
||||||
|
return ${ret}
|
||||||
|
fi
|
||||||
|
|
||||||
|
for file in ${@}; do
|
||||||
|
local url=$(curl --progress-bar --form "files[]=@${file}" \
|
||||||
|
'https://tmp.ninja/upload.php?output=text')
|
||||||
|
print '\e[1;95m→\e[0m' ${url}
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user