mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Merge 7828042726 into 291e96dcd0
This commit is contained in:
commit
aa7e69aa0d
2 changed files with 31 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
|
||||
25
plugins/transfer/transfer.plugin.zsh
Normal file
25
plugins/transfer/transfer.plugin.zsh
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# From https://transfer.sh/
|
||||
# Modified by Gabriel Kaam <gabriel@kaam.fr>
|
||||
|
||||
function transfer() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
cat<<EOF
|
||||
No arguments specified. Usage:
|
||||
transfer /tmp/test.md
|
||||
cat /tmp/test.md | transfer test.md
|
||||
EOF
|
||||
return 1
|
||||
fi
|
||||
|
||||
basefile=$(omz_urlencode "${1:t}")
|
||||
|
||||
if tty -s; then
|
||||
url=$(curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile")
|
||||
else
|
||||
url=$(curl --progress-bar --upload-file "-" "https://transfer.sh/$basefile")
|
||||
fi
|
||||
|
||||
echo $url
|
||||
}
|
||||
|
||||
alias transfer=transfer
|
||||
Loading…
Add table
Add a link
Reference in a new issue