From 54b772cae06eb25adf33297e35234f33ded81a7b Mon Sep 17 00:00:00 2001
From: Saumit Dinesan <justsaumit@protonmail.com>
Date: Sat, 12 Mar 2022 19:54:51 +0530
Subject: neovim addition

---
 .scripts/upmenu | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100755 .scripts/upmenu

(limited to '.scripts/upmenu')

diff --git a/.scripts/upmenu b/.scripts/upmenu
new file mode 100755
index 0000000..f600e3a
--- /dev/null
+++ b/.scripts/upmenu
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# hello guys its mokuken!!
+
+function upmenu {
+        options="Upload a File\nRecent Uploads\nCancel"
+        selected=$(echo -e $options | dmenu -l 3 )
+		if [[ "$selected" == "Upload a File" ]]; then
+		
+		target="$1"
+		[ -z "$target" ] && target="$(realpath .)"
+		
+		while :; do
+		        sel="$(ls -1a "$target" | grep -v '^\.$' | dmenu -l 25 )" || exit
+		        if [ "$(echo "$sel" | cut -b1)" = "/" ]; then
+		                newt="$sel"
+		        else
+		                newt="$(realpath "$target/$sel")"
+		        fi
+		        if [ -e "$newt" ]; then
+		                target="$newt"
+		                if [ ! -d "$target" ]; then
+		                        echo "Location: $target"
+								command="curl -s -F'file=@$target' https://0x0.st"
+               					echo "Executing: $command"
+
+               					url=$(eval $command)
+              					echo "URL: $url"
+
+              					printf "$url" | xclip -sel clip
+             					notify-send "File Uploaded" "URL: $url \ncopied to clipboard" -t 5000 -i "$HOME/.program/icon.png"
+
+               					entry="$(date '+%d-%m-%y-%H:%M:%S')    $url    $(echo $target | awk -F'/' '{print $(NF)}')"
+             					echo $entry >> $HOME/.0x0_list
+             					echo "Uploaded"; break
+		                fi
+		        fi
+		done
+		elif [[ "$selected" == "Recent Uploads" ]]; then
+				    cat ~/.0x0_list | dmenu -l 10
+		elif [[ "$selected" == "Cancel" ]]; then
+					return
+				fi
+}
+
+upmenu
-- 
cgit v1.2.3