repo: uritools
action: commit
revision: 
path_from: 
revision_from: e341a2a428ab30126af4148f5022b60be360a624:
path_to: 
revision_to: 
git.thebackupbox.net
uritools
git clone git://git.thebackupbox.net/uritools
commit e341a2a428ab30126af4148f5022b60be360a624
Author: epoch 
Date:   Sun Nov 14 04:29:01 2021 +0000

    uristart now asks you if there are multiple matches which one you want to use

diff --git a/uristart b/uristart
index 2b0d7f28b88f8b0cf6c6de31a4e10040f4436c36..
index ..51b54da64ccb8db16a27bc3f5c2ca94065029b5a 100755
--- a/uristart
+++ b/uristart
@@ -58,7 +58,14 @@ fi
 uri="${1}"
 scheme="$(printf "%s\n" "$uri" | uricut -s)"

-line="$(urigetline "$uri")"
+### original: line="$(urigetline "$uri" < ~/.config/uristart.conf)"
+line="$(urigetline "$uri" < ~/.config/uristart.conf)"
+if [ "$(urigetline -a "$uri" < ~/.config/uristart.conf)" != "$line" ];then
+  line="$(urigetline -a "$uri" < ~/.config/uristart.conf | choose 'which handler')"
+fi
+if [ ! "$line" ];then
+  exit 0
+fi

 ### if we do not have a port, we are going to try to get it from their srv records.
 if printf "%s\n" "$uri" | urimatch nP >/dev/null;then
@@ -92,12 +99,15 @@ if [ "$line" = "" ];then
 fi

 ### log the uri if it isn't logged already.
+### and don't log search: URIs because... why not?
 if [ -w ~/.cache/uristart.log ];then #only log if it is writable
   if ! cut '-d ' -f1 ~/.cache/uristart.log | grep -Fx "$uri" 2>&1 >/dev/null;then #only log URIs that aren't already listed
-    if [ "$2" ];then
-      printf "%s %s\n" "$uri" "$2" >> ~/.cache/uristart.log
-    else
-      printf "%s\n" "$uri" >> ~/.cache/uristart.log
+    if printf "%s\n" "$uri" | urimatch rs search >/dev/null;then
+      if [ "$2" ];then
+        printf "%s %s\n" "$uri" "$2" >> ~/.cache/uristart.log
+      else
+        printf "%s\n" "$uri" >> ~/.cache/uristart.log
+      fi
     fi
   fi
 else
@@ -106,6 +116,7 @@ fi

 ### do the magic
 if [ "$check" = "check" ];then
+  ## might put an extra check in here to output to not-terminal if no terminal exists
   printf "%s\n" "$(printf "%s\n" "$uri" | sed 's/'\''/'\''\\'\'''\''/g' | uriprintf "$line")"
 else
   eval "$(printf "%s\n" "$uri" | sed 's/'\''/'\''\\'\'''\''/g' | uriprintf "$line")"

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