summaryrefslogtreecommitdiff
path: root/uristart
diff options
context:
space:
mode:
Diffstat (limited to 'uristart')
-rwxr-xr-xuristart21
1 files changed, 16 insertions, 5 deletions
diff --git a/uristart b/uristart
index 2b0d7f2..51b54da 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")"