Browse Source

Use more convenient routine and file names

Make them shorter but also sortable (ie. 'conv' for converters, 'flt'
for filters.)
Alois Mahdal 9 years ago
parent
commit
033b3902a7
2 changed files with 27 additions and 26 deletions
  1. 19
    18
      src/ffoo/saturnin_urimagic.sh
  2. 8
    8
      src/libexec/saturnin-www

+ 19
- 18
src/ffoo/saturnin_urimagic.sh View File

@@ -4,7 +4,7 @@ ffoo import inigrep
4 4
 ffoo import pretty
5 5
 
6 6
 
7
-__saturnin_urimagic__filter_exprs() {
7
+__saturnin_urimagic__flt_exps() {
8 8
     #
9 9
     # Hack expressions like bug = 123 out of the text
10 10
     #
@@ -16,7 +16,7 @@ __saturnin_urimagic__filter_exprs() {
16 16
 }
17 17
 
18 18
 
19
-__saturnin_urimagic__filter_ids() {
19
+__saturnin_urimagic__flt_ids() {
20 20
     #
21 21
     # Hack doer-like id's (ID#123) out of the text
22 22
     #
@@ -28,7 +28,7 @@ __saturnin_urimagic__filter_ids() {
28 28
 }
29 29
 
30 30
 
31
-__saturnin_urimagic__filter_tags() {
31
+__saturnin_urimagic__flt_tags() {
32 32
     #
33 33
     # Hack "tags" like bug123 out of the text
34 34
     #
@@ -37,7 +37,7 @@ __saturnin_urimagic__filter_tags() {
37 37
 }
38 38
 
39 39
 
40
-__saturnin_urimagic__filter_kws() {
40
+__saturnin_urimagic__flt_kws() {
41 41
     #
42 42
     # Hack out lines that look like kw expressions
43 43
     #
@@ -45,7 +45,7 @@ __saturnin_urimagic__filter_kws() {
45 45
 }
46 46
 
47 47
 
48
-__saturnin_urimagic__filter_uris() {
48
+__saturnin_urimagic__flt_uris() {
49 49
     #
50 50
     # Hack URIs out of the text.
51 51
     #
@@ -78,24 +78,25 @@ saturnin_urimagic__scan() {
78 78
         ##
79 79
         # heat up and fill pipes
80 80
         #
81
-        mkfifo maybe_uris maybe_ids maybe_exprs maybe_tags maybe_kws \
82
-               uris uris_from_ids uris_from_exprs uris_from_tags uris_from_kws
83
-        cat | tee maybe_uris maybe_ids maybe_exprs maybe_tags maybe_kws >/dev/null &
81
+        mkfifo maybe_uris maybe_ids maybe_exps maybe_tags maybe_kws \
82
+               uris uris_from_ids uris_from_exps uris_from_tags uris_from_kws
83
+        cat | tee maybe_uris maybe_ids maybe_exps maybe_tags maybe_kws \
84
+            >/dev/null &
84 85
         ##
85 86
         # process each pipe *async* by different filter
86 87
         #
87
-        < maybe_uris  ${p}filter_uris                     > uris &
88
-        < maybe_ids   ${p}filter_ids   | ${p}id2kw   | ${p}kw2uri > uris_from_ids &
89
-        < maybe_exprs ${p}filter_exprs | ${p}expr2kw | ${p}kw2uri > uris_from_exprs &
90
-        < maybe_tags  ${p}filter_tags  | ${p}tag2kw  | ${p}kw2uri > uris_from_tags &
91
-        < maybe_kws   ${p}filter_kws   |               ${p}kw2uri > uris_from_kws &
88
+        < maybe_uris ${p}flt_uris                            > uris &
89
+        < maybe_ids  ${p}flt_ids  | ${p}conv_id  | ${p}deref > uris_from_ids &
90
+        < maybe_exps ${p}flt_exps | ${p}conv_exp | ${p}deref > uris_from_exps &
91
+        < maybe_tags ${p}flt_tags | ${p}conv_tag | ${p}deref > uris_from_tags &
92
+        < maybe_kws  ${p}flt_kws  |                ${p}deref > uris_from_kws &
92 93
         ##
93 94
         # print result *sync* in correct order
94 95
         #
95 96
         {
96 97
             cat uris
97 98
             cat uris_from_ids
98
-            cat uris_from_exprs
99
+            cat uris_from_exps
99 100
             cat uris_from_tags
100 101
             cat uris_from_kws
101 102
         } | grep .  # throw away empties; add missing LF
@@ -104,7 +105,7 @@ saturnin_urimagic__scan() {
104 105
 }
105 106
 
106 107
 
107
-__saturnin_urimagic__id2kw() {
108
+__saturnin_urimagic__conv_id() {
108 109
     #
109 110
     # Convert doer-like ID to kw expression
110 111
     #
@@ -112,7 +113,7 @@ __saturnin_urimagic__id2kw() {
112 113
 }
113 114
 
114 115
 
115
-__saturnin_urimagic__tag2kw() {
116
+__saturnin_urimagic__conv_tag() {
116 117
     #
117 118
     # Convert tag to kw expression
118 119
     #
@@ -120,7 +121,7 @@ __saturnin_urimagic__tag2kw() {
120 121
 }
121 122
 
122 123
 
123
-__saturnin_urimagic__expr2kw() {
124
+__saturnin_urimagic__conv_exp() {
124 125
     #
125 126
     # Convert equal sign expression to kw expression
126 127
     #
@@ -128,7 +129,7 @@ __saturnin_urimagic__expr2kw() {
128 129
 }
129 130
 
130 131
 
131
-__saturnin_urimagic__kw2uri() {
132
+__saturnin_urimagic__deref() {
132 133
     #
133 134
     # Turn keyword or query (like "g hello" for google) to URI
134 135
     #

+ 8
- 8
src/libexec/saturnin-www View File

@@ -52,14 +52,14 @@ debug "\$@='$@'"
52 52
 debug -v src
53 53
 
54 54
 case "$src" in
55
-    args) uri="$(echo "$@" | find_uri)" ;;
56
-    file) uri="$(cat "$file" | find_uri)" ;;
57
-    xpri) uri="$(clipln pri | find_uri)" ;;
58
-    xsec) uri="$(clipln sec | find_uri)" ;;
59
-    xclp) uri="$(clipln clp | find_uri)" ;;
60
-    xall) uri="$(clipln pri | find_uri)"
61
-          uri="$(clipln sec | find_uri)"
62
-          uri="$(clipln clp | find_uri)"
55
+    args) uri="$(echo "$@" | saturnin_urimagic__scan)" ;;
56
+    file) uri="$(cat "$file" | saturnin_urimagic__scan)" ;;
57
+    xpri) uri="$(clipln pri | saturnin_urimagic__scan)" ;;
58
+    xsec) uri="$(clipln sec | saturnin_urimagic__scan)" ;;
59
+    xclp) uri="$(clipln clp | saturnin_urimagic__scan)" ;;
60
+    xall) uri="$(clipln pri | saturnin_urimagic__scan)"
61
+          uri="$(clipln sec | saturnin_urimagic__scan)"
62
+          uri="$(clipln clp | saturnin_urimagic__scan)"
63 63
           ;;
64 64
 esac
65 65
 debug -v uri