|
@@ -4,7 +4,7 @@ ffoo import inigrep
|
4
|
4
|
ffoo import pretty
|
5
|
5
|
|
6
|
6
|
|
7
|
|
-filter_exprs() {
|
|
7
|
+__saturnin_urimagic__filter_exprs() {
|
8
|
8
|
#
|
9
|
9
|
# Hack expressions like bug = 123 out of the text
|
10
|
10
|
#
|
|
@@ -16,7 +16,7 @@ filter_exprs() {
|
16
|
16
|
}
|
17
|
17
|
|
18
|
18
|
|
19
|
|
-filter_ids() {
|
|
19
|
+__saturnin_urimagic__filter_ids() {
|
20
|
20
|
#
|
21
|
21
|
# Hack doer-like id's (ID#123) out of the text
|
22
|
22
|
#
|
|
@@ -28,7 +28,7 @@ filter_ids() {
|
28
|
28
|
}
|
29
|
29
|
|
30
|
30
|
|
31
|
|
-filter_tags() {
|
|
31
|
+__saturnin_urimagic__filter_tags() {
|
32
|
32
|
#
|
33
|
33
|
# Hack "tags" like bug123 out of the text
|
34
|
34
|
#
|
|
@@ -37,7 +37,7 @@ filter_tags() {
|
37
|
37
|
}
|
38
|
38
|
|
39
|
39
|
|
40
|
|
-filter_kws() {
|
|
40
|
+__saturnin_urimagic__filter_kws() {
|
41
|
41
|
#
|
42
|
42
|
# Hack out lines that look like kw expressions
|
43
|
43
|
#
|
|
@@ -45,7 +45,7 @@ filter_kws() {
|
45
|
45
|
}
|
46
|
46
|
|
47
|
47
|
|
48
|
|
-filter_uris() {
|
|
48
|
+__saturnin_urimagic__filter_uris() {
|
49
|
49
|
#
|
50
|
50
|
# Hack URIs out of the text.
|
51
|
51
|
#
|
|
@@ -57,7 +57,7 @@ filter_uris() {
|
57
|
57
|
}
|
58
|
58
|
|
59
|
59
|
|
60
|
|
-find_uri() {
|
|
60
|
+saturnin_urimagic__scan() {
|
61
|
61
|
#
|
62
|
62
|
# Scan stdin for what looks like URI, ID or keyword
|
63
|
63
|
#
|
|
@@ -73,6 +73,7 @@ find_uri() {
|
73
|
73
|
# if you are brave, open all URIs.
|
74
|
74
|
#
|
75
|
75
|
local d=$(mktemp -d -t saturnin_urimagic.XXXXXXXX)
|
|
76
|
+ local p=__saturnin_urimagic__
|
76
|
77
|
pushd $d >&/dev/null
|
77
|
78
|
##
|
78
|
79
|
# heat up and fill pipes
|
|
@@ -83,11 +84,11 @@ find_uri() {
|
83
|
84
|
##
|
84
|
85
|
# process each pipe *async* by different filter
|
85
|
86
|
#
|
86
|
|
- < maybe_uris filter_uris > uris &
|
87
|
|
- < maybe_ids filter_ids | id2kw | kw2uri > uris_from_ids &
|
88
|
|
- < maybe_exprs filter_exprs | expr2kw | kw2uri > uris_from_exprs &
|
89
|
|
- < maybe_tags filter_tags | tag2kw | kw2uri > uris_from_tags &
|
90
|
|
- < maybe_kws filter_kws | kw2uri > uris_from_kws &
|
|
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 &
|
91
|
92
|
##
|
92
|
93
|
# print result *sync* in correct order
|
93
|
94
|
#
|
|
@@ -103,7 +104,7 @@ find_uri() {
|
103
|
104
|
}
|
104
|
105
|
|
105
|
106
|
|
106
|
|
-id2kw() {
|
|
107
|
+__saturnin_urimagic__id2kw() {
|
107
|
108
|
#
|
108
|
109
|
# Convert doer-like ID to kw expression
|
109
|
110
|
#
|
|
@@ -111,7 +112,7 @@ id2kw() {
|
111
|
112
|
}
|
112
|
113
|
|
113
|
114
|
|
114
|
|
-tag2kw() {
|
|
115
|
+__saturnin_urimagic__tag2kw() {
|
115
|
116
|
#
|
116
|
117
|
# Convert tag to kw expression
|
117
|
118
|
#
|
|
@@ -119,7 +120,7 @@ tag2kw() {
|
119
|
120
|
}
|
120
|
121
|
|
121
|
122
|
|
122
|
|
-expr2kw() {
|
|
123
|
+__saturnin_urimagic__expr2kw() {
|
123
|
124
|
#
|
124
|
125
|
# Convert equal sign expression to kw expression
|
125
|
126
|
#
|
|
@@ -127,7 +128,7 @@ expr2kw() {
|
127
|
128
|
}
|
128
|
129
|
|
129
|
130
|
|
130
|
|
-kw2uri() {
|
|
131
|
+__saturnin_urimagic__kw2uri() {
|
131
|
132
|
#
|
132
|
133
|
# Turn keyword or query (like "g hello" for google) to URI
|
133
|
134
|
#
|