]> Sergey Matveev's repositories - nnn.git/commitdiff
Add script to upload a file to transfer.sh
authorArun Prakash Jana <engineerarun@gmail.com>
Sun, 24 Mar 2019 12:08:29 +0000 (17:38 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sun, 24 Mar 2019 12:10:15 +0000 (17:40 +0530)
user-scripts/README.md
user-scripts/imgresize
user-scripts/transfer [new file with mode: 0755]

index 1bfcbd47535e45b3fd6365271f760e18a89c7b61..cbed78489c8ca3b132067fc06c7c8b2c966e2be1 100644 (file)
@@ -13,4 +13,5 @@
 | nlaunch | Drop-down independent app launcher (needs fzy), drop in `$PATH`; fallback regular prompt |
 | picker | Pick files and pipe the newline-separated list to another utility |
 | sxiv | Open images in current directory in sxiv |
+| transfer | Upload current file to transfer.sh |
 | upgrade | Check and update to latest version of nnn manually on Debian 9 Stretch |
index 40b994589c81c1d77a41ef09cc9fd3c36ce8c01a..6d016f1d46491b69871c34ef19f418b000d977a9 100755 (executable)
@@ -25,7 +25,7 @@ if [ -z "$res" ]; then
     read res
 fi
 
-if [ -z "$res" ]; then
+if [ -z "$res" ]; then
     if ! [ -z "$minsize" ]; then
         imgp -ackx "$res" -s "$minsize"
     fi
diff --git a/user-scripts/transfer b/user-scripts/transfer
new file mode 100755 (executable)
index 0000000..7201b0b
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env sh
+
+# Description: Upload a file to transfer.sh
+#
+# Shell: POSIX compliant
+# Author: Arun Prakash Jana
+
+if ! [ -z "$1" ]; then
+    # Upload the file, show the download link and wait till user presses any key
+    curl -s --upload-file "$1" https://transfer.sh/`basename "$1"`
+    echo
+    read input
+
+    # To write download link to "$1".loc and exit
+    # curl -s --upload-file "$1" https://transfer.sh/`basename "$1"` -o `basename "$1"`.loc
+fi