Adds transfer.sh plugin

This commit is contained in:
Gabriel Kaam 2017-03-07 19:46:36 +01:00
parent b908feebcf
commit 6c6e66900e
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,6 @@
# Transfer.sh
[Transfer.sh](https://transfer.sh/) plugin - easy file sharing from the command line
## Usage
Just type `transfer hello.txt` and let the magic happen

View File

@ -0,0 +1,30 @@
# From https://transfer.sh/
# Modified by Gabriel Kaam <gabriel@kaam.fr>
function transfer() {
if [[ $# -eq 0 ]]; then
cat >&2 <<EOF
No arguments specified.
Usage: transfer /tmp/test.md
cat /tmp/test.md | transfer test.md
Learn more: https://transfer.sh/
EOF
return 1
fi
local basefile url infile="$1"
basefile=$(omz_urlencode "${infile:t}")
if [[ -z $infile ]]; then
infile="-"
fi
url=$(curl --progress-bar --upload-file "$infile" "https://transfer.sh/$basefile")
echo $url
}
alias transfer=transfer