Adds transfer.sh plugin
This commit is contained in:
parent
b908feebcf
commit
6c6e66900e
6
plugins/transfer/README.md
Normal file
6
plugins/transfer/README.md
Normal 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
|
30
plugins/transfer/transfer.plugin.zsh
Normal file
30
plugins/transfer/transfer.plugin.zsh
Normal 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
|
Loading…
Reference in New Issue
Block a user