mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-27 03:14:56 +01:00
25 lines
518 B
Bash
25 lines
518 B
Bash
# 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
|