mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-01 04:30:37 +02:00
Adds transfer.sh plugin
This commit is contained in:
parent
b908feebcf
commit
6c6e66900e
2 changed files with 36 additions and 0 deletions
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…
Add table
Add a link
Reference in a new issue