repo: uritools
action: commit
revision: 
path_from: 
revision_from: 7b3921a87a316c85324445cc76ca7b34eb07da3f:
path_to: 
revision_to: 
git.thebackupbox.net
uritools
git clone git://git.thebackupbox.net/uritools
commit 7b3921a87a316c85324445cc76ca7b34eb07da3f
Author: epoch 
Date:   Thu Aug 6 15:38:31 2020 -0500

    copy_start_nevermind now only shows the user a shortened version, has extra "verbose" option to see whole thing, and a "forget" option which might be flakey if you select an empty URI

diff --git a/choose b/choose
index 1b989fde5f4c71ced37892218f5d5157cb5f7f18..
index ..73c74aa10aaab91d0e65b514e31f2670fa1cf39f 100755
--- a/choose
+++ b/choose
@@ -3,5 +3,7 @@
 ### then give the user a way of selecting on of them.
 ### it should output the selection on a line by itself.
 ### and use $1 as the message to give to the user.
-sed 's|,|\\,|g;s|:|\\:|g' | tr '\n' ',' | rev | cut -b2- | rev | tr '\n' '\0' | xargs -0 xmessage -nearmouse "$1" -print -buttons
-#dmenu -p "$1"
+#message=$1
+#shift
+#sed 's|,|\\,|g;s|:|\\:|g' | tr '\n' ',' | rev | cut -b2- | rev | tr '\n' '\0' | xargs -0 xmessage -nearmouse "$@" "$message" -print -buttons
+dmenu -l 10 -p "$1"
diff --git a/copy_start_nevermind.sh b/copy_start_nevermind.sh
index cae566815ac828e34bb7820e6bd0736fbbd4d356..
index ..9c772354479c15efa59dec880e8ec4e564d3af01 100755
--- a/copy_start_nevermind.sh
+++ b/copy_start_nevermind.sh
@@ -1,15 +1,37 @@
 #!/bin/bash
-scheme="$(uricut -s <<< "$1")"
-selection="$(printf "%s\ncopy\nstart\nnevermind\n" "$(printf "%s\n" "$1" | uricut | grep -v '^whole')" \
-            | choose "$(printf "uri: '%s'\nwill be ran with: %s\n" "$1" "$(urigetline "$1")" )")"
+[ "$1" ] || exit 1
+uri="$1"
+if [ "${uri}" != "${uri:0:64}" ];then
+  prompt="${uri:0:64}..."
+fi
+scheme="$(uricut -s <<< "$uri")"
+selection="$(printf "start\ncopy\nshorten\nverbose\nforget\n%s\n" "$(printf "%s\n" "$uri" | uricut | grep -v '^whole')" \
+             | choose "${prompt}")"
+#            | choose "$(printf "uri: '%s'\nwill be ran with: %s\n" "$uri" "$(urigetline "$uri")" )" -default start )"
 echo "$selection"
+if [ "$selection" = "verbose" ];then
+  x-terminal-emulator -e less -f <(printf "%s" "$uri")
+  exit 0
+fi
 if [ "$selection" = "copy" ];then
-  printf "%s" "$1" | xclip -i
+  printf "%s" "$uri" | xclip -i
+  exit 0
+fi
+if [ "$selection" = "forget" ];then
+  cp ~/.cache/uristart.log ~/.cache/uristart.log.tmp
+  cat ~/.cache/uristart.log.tmp | grep -vFw "${uri}" > ~/.cache/uristart.log
   exit 0
 fi
 if [ "$selection" = "start" ];then
-  scheme="$(printf "%s\n" "$1" | uricut -s)"
-  exec uristart "$1" "$(xdotool getwindowfocus getwindowname)"
+  scheme="$(printf "%s\n" "$uri" | uricut -s)"
+  exec uristart "$uri" "$(xdotool getwindowfocus getwindowname)"
+  exit 0
+fi
+if [ "$selection" = "shorten" ];then
+  escaped="$(uriescape "$uri")"
+  gemini-get "gemini://epo.k.vu/submit?$escaped" | tr -d '\r' | tail -n+2 | head -n2 | tr '\n' '\0' | xargs -n1 -0 copy_start_nevermind.sh
   exit 0
 fi
-exec printf "%s" "$selection" | cut '-d ' -f2- | xclip -i
+if [ "$selection" ];then
+  exec printf "%s" "$selection" | cut '-d ' -f2- | xclip -i
+fi

-----END OF PAGE-----