summaryrefslogtreecommitdiff
path: root/uristart
diff options
context:
space:
mode:
authorepoch <epoch@enzo.thebackupbox.net>2021-11-14 04:29:01 +0000
committerepoch <epoch@enzo.thebackupbox.net>2021-11-14 04:29:01 +0000
commite341a2a428ab30126af4148f5022b60be360a624 (patch)
tree4385c751c113d4bbd660754b39574c00dccf7941 /uristart
parente30cd702286d91b99107bab4005e32e1e480c83f (diff)
downloaduritools-e341a2a428ab30126af4148f5022b60be360a624.tar.gz
uritools-e341a2a428ab30126af4148f5022b60be360a624.zip
uristart now asks you if there are multiple matches which one you want to use
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")"