diff options
author | epoch <epoch@enzo.thebackupbox.net> | 2021-11-14 04:29:01 +0000 |
---|---|---|
committer | epoch <epoch@enzo.thebackupbox.net> | 2021-11-14 04:29:01 +0000 |
commit | e341a2a428ab30126af4148f5022b60be360a624 (patch) | |
tree | 4385c751c113d4bbd660754b39574c00dccf7941 /uristart | |
parent | e30cd702286d91b99107bab4005e32e1e480c83f (diff) | |
download | uritools-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-x | uristart | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -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")" |