Browse Source

Move inigrep prefix setting to saturnin-www

Alois Mahdal 9 years ago
parent
commit
04dfabd117
2 changed files with 14 additions and 2 deletions
  1. 11
    2
      src/ffoo/saturnin_urimagic.sh
  2. 3
    0
      src/libexec/saturnin-www

+ 11
- 2
src/ffoo/saturnin_urimagic.sh View File

@@ -4,6 +4,13 @@ ffoo import inigrep
4 4
 ffoo import pretty
5 5
 
6 6
 
7
+#
8
+# Prefix for inigrep path for 1 and 2-arg queries
9
+#
10
+saturnin_urimagic__inipfx0="${saturnin_urimagic__inipfx0:-}"
11
+saturnin_urimagic__inipfxN="${saturnin_urimagic__inipfxN:-}"
12
+
13
+
7 14
 saturnin_urimagic__scan() {
8 15
     #
9 16
     # Scan stdin for what looks like URI, ID or keyword
@@ -58,6 +65,8 @@ __saturnin_urimagic__deref() {
58 65
     local line      # input line,   eg. "g hello dolly" or "bug 1234"
59 66
     local kw        # keyword part, eg. "g"             or "bug"
60 67
     local query     # query part,   eg. "hello dolly"   or "1234"
68
+    local pfx0=$saturnin_urimagic__inipfx0
69
+    local pfxN=$saturnin_urimagic__inipfxN
61 70
     while read line;
62 71
     do
63 72
         line="$line "
@@ -66,11 +75,11 @@ __saturnin_urimagic__deref() {
66 75
         debug -v kw query
67 76
         if test -n "$query";
68 77
         then
69
-            local fmt=$(inigrep -j -1 -p www.query.${kw,,})
78
+            local fmt=$(inigrep -j -1 -p $pfxN.${kw,,})
70 79
             debug -v fmt
71 80
             printf "$fmt\n" "$query"
72 81
         else
73
-            inigrep -j -1 -p www.bookmark.$kw
82
+            inigrep -j -1 -p $pfx0.$kw
74 83
         fi
75 84
     done
76 85
 }

+ 3
- 0
src/libexec/saturnin-www View File

@@ -7,6 +7,9 @@ ffoo import pretty
7 7
 
8 8
 ffoo import saturnin_urimagic
9 9
 
10
+saturnin_urimagic__inipfx0="www.bookmark"
11
+saturnin_urimagic__inipfxN="www.query"
12
+
10 13
 #
11 14
 # On clipboards:
12 15
 #