summaryrefslogtreecommitdiff
path: root/uristart
diff options
context:
space:
mode:
authorepoch <epoch@enzo.thebackupbox.net>2021-11-14 08:15:19 +0000
committerepoch <epoch@enzo.thebackupbox.net>2021-11-14 08:15:19 +0000
commit285a0741ad4853698b4b2563fb8844b484410def (patch)
tree9f734a45d6774b6017c648cf1fd7b92e3293dd0f /uristart
parent70e79463fef28e915926738233913129e80a434b (diff)
downloaduritools-285a0741ad4853698b4b2563fb8844b484410def.tar.gz
uritools-285a0741ad4853698b4b2563fb8844b484410def.zip
added ability to split config file into a handful of smaller files and made things that need that data to get it from uristart.conf script
Diffstat (limited to 'uristart')
-rwxr-xr-xuristart23
1 files changed, 15 insertions, 8 deletions
diff --git a/uristart b/uristart
index 50ee573..1c3e382 100755
--- a/uristart
+++ b/uristart
@@ -12,7 +12,7 @@ check=dont
eval "$(printf "%s\n" "$1" | uricut | sed 's/^/export URI/;s/'\''/'\''\\'\'''\''/;s/: /='\''/g;s/$/'\''/')"
-uristart_config=~/.config/uristart.conf
+uristart_config="auto"
usage() {
printf "usage: uristart [-v|--verbose|-h|--help|-c|--check] [-f|--config file] URI\n"
@@ -50,18 +50,25 @@ if [ ! "$*" ];then
exit 1
fi
-if [ ! -e "$uristart_config" ];then
- printf "uristart: missing config file: %s\n" "$uristart_config" >&2
- exit 1
-fi
+#if [ ! -e "$uristart_config" ];then
+# printf "uristart: missing config file: %s\n" "$uristart_config" >&2
+# exit 1
+#fi
uri="${1}"
scheme="$(printf "%s\n" "$uri" | uricut -s)"
+### TODO: make this respect the --config|-f flag
### 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')"
+if [ "$uristart_config" = "auto" ];then
+ line="$(urigetline "$uri" < <(uristart.conf))"
+ allline="$(urigetline -a "$uri" < <(uristart.conf))"
+else
+ line="$(urigetline "$uri" < "$uristart_config")"
+ allline="$(urigetline -a "$uri" < "$uristart_config")"
+fi
+if [ "$allline" != "$line" ];then
+ line="$(printf "%s\n" "$allline" | choose 'which handler')"
fi
if [ ! "$line" ];then
exit 0