summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlyes Kechidi <ilyes.spd@gmail.com>2016-11-23 02:21:18 +0100
committerIlyes Kechidi <ilyes.spd@gmail.com>2017-02-07 14:32:32 +0100
commit76c102944c8c164f2cf8908712b6c6a1d9fe5d70 (patch)
tree0cc8eeb126f0b6b7172a47966dc6ef88500bb27e
parent0b340bc3a5c58609a07987b296f773eaea17b274 (diff)
downloadzsh-76c102944c8c164f2cf8908712b6c6a1d9fe5d70.tar.gz
zsh-76c102944c8c164f2cf8908712b6c6a1d9fe5d70.tar.bz2
zsh-76c102944c8c164f2cf8908712b6c6a1d9fe5d70.zip
added a transfer.sh plugin
created a function to easily upload files to transfer.sh file sharing site Usage : transfer file.txt
-rw-r--r--plugins/transfer/transfer.plugin.zsh7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/transfer/transfer.plugin.zsh b/plugins/transfer/transfer.plugin.zsh
new file mode 100644
index 000000000..7d0d84bea
--- /dev/null
+++ b/plugins/transfer/transfer.plugin.zsh
@@ -0,0 +1,7 @@
+# transfer.sh Easy file sharing from the command line
+# transfer Plugin
+# Usage Example :
+# > transfer file.txt
+
+transfer() { if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
+tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } \ No newline at end of file