diff options
author | epoch <epoch@thebackupbox.net> | 2020-04-20 03:15:36 -0500 |
---|---|---|
committer | epoch <epoch@thebackupbox.net> | 2020-04-20 03:15:36 -0500 |
commit | 3e23d5631b7664de5a78aaaac211bff357152c00 (patch) | |
tree | 8c3c80760e0f122a56c8835923cba739f8674a81 /uristart | |
parent | ba14e2682f947c2dff57a3d8aaf754a9a00e246b (diff) | |
download | uritools-3e23d5631b7664de5a78aaaac211bff357152c00.tar.gz uritools-3e23d5631b7664de5a78aaaac211bff357152c00.zip |
uristart.conf-breaking changes by using urimatch instead of matching only on scheme
Diffstat (limited to 'uristart')
-rwxr-xr-x | uristart | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -17,7 +17,29 @@ fi uri="${1}" scheme="$(printf "%s\n" "$uri" | uricut -s)" -line="$(grep "^${scheme}:" ~/.config/uristart.conf | cut -d: -f2- | sed 's/^[ \t]*//g' | sed 's/\\/\\\\/g')" +#line="$(grep "^${scheme}:" ~/.config/uristart.conf | cut -d: -f2- | sed 's/^[ \t]*//g' | sed 's/\\/\\\\/g')" + +line="$( +cat ~/.config/uristart.conf \ + | while read -r l;do + uritmp="$uri" + uritmp="$(printf "%s\n" "$l" \ + | cut -d: -f1 \ + | tr ' ' '\n' \ + | paste '-d ' - - \ + | while read -r a b;do + uritmp="$(printf "%s\n" "${uritmp}" | urimatch "$a" "$b")" + printf "%s\n" "$uritmp" + done | tail -n1)" + if [ "$uritmp" ];then + printf '%s\n' "$l" + break + fi + done \ + | cut -d: -f2- \ + | sed 's/^[ \t]*//g' \ + | sed 's/\\/\\\\/g' +)" ### 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 |