doing 2.0.10 → 2.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/Gemfile.lock +5 -15
- data/README.md +1 -1
- data/Rakefile +2 -0
- data/bin/doing +58 -36
- data/doing.gemspec +2 -1
- data/doing.rdoc +1 -71
- data/lib/completion/_doing.zsh +24 -20
- data/lib/completion/doing.bash +41 -30
- data/lib/completion/doing.fish +50 -1
- data/lib/doing/array.rb +14 -1
- data/lib/doing/item.rb +18 -17
- data/lib/doing/log_adapter.rb +9 -6
- data/lib/doing/string.rb +2 -2
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +94 -46
- data/lib/doing.rb +1 -1
- metadata +16 -22
data/lib/completion/doing.fish
CHANGED
@@ -64,6 +64,7 @@ complete -xc doing -n '__fish_doing_needs_command' -a 'autotag' -d Autotag\ last
|
|
64
64
|
complete -xc doing -n '__fish_doing_needs_command' -a 'cancel' -d End\ last\ X\ entries\ with\ no\ time\ tracked
|
65
65
|
complete -xc doing -n '__fish_doing_needs_command' -a 'choose' -d Select\ a\ section\ to\ display\ from\ a\ menu
|
66
66
|
complete -xc doing -n '__fish_doing_needs_command' -a 'colors' -d List\ available\ color\ variables\ for\ configuration\ templates\ and\ views
|
67
|
+
complete -xc doing -n '__fish_doing_needs_command' -a 'completion' -d Generate\ shell\ completion\ scripts
|
67
68
|
complete -xc doing -n '__fish_doing_needs_command' -a 'config' -d Edit\ the\ configuration\ file\ or\ output\ a\ value\ from\ it
|
68
69
|
complete -xc doing -n '__fish_doing_needs_command' -a 'done did' -d Add\ a\ completed\ item\ with\ @done\(date\)
|
69
70
|
complete -xc doing -n '__fish_doing_needs_command' -a 'finish' -d Mark\ last\ X\ entries\ as\ @done
|
@@ -96,20 +97,26 @@ complete -xc doing -n '__fish_doing_needs_command' -a 'views' -d List\ available
|
|
96
97
|
complete -xc doing -n '__fish_doing_needs_command' -a 'wiki' -d Output\ a\ tag\ wiki
|
97
98
|
complete -xc doing -n '__fish_doing_needs_command' -a 'yesterday' -d List\ entries\ from\ yesterday
|
98
99
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command again resume' -d Boolean\ used\ to\ combine\ multiple\ tags
|
100
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command again resume' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
99
101
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command again resume' -d Edit\ duplicated\ entry\ with\ vim\ before\ adding
|
100
102
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command again resume' -d Select\ item\ to\ resume\ from\ a\ menu\ of\ matching\ entries
|
101
103
|
complete -c doing -l in -f -r -n '__fish_doing_using_command again resume' -d Add\ new\ entry\ to\ section
|
102
104
|
complete -c doing -l note -s n -f -r -n '__fish_doing_using_command again resume' -d Note
|
105
|
+
complete -c doing -l not -f -n '__fish_doing_using_command again resume' -d Resume\ items\ that\ \*don\'t\*\ match\ search/tag\ filters
|
103
106
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command again resume' -d Get\ last\ entry\ from\ a\ specific\ section
|
104
107
|
complete -c doing -l search -f -r -n '__fish_doing_using_command again resume' -d Repeat\ last\ entry\ matching\ search
|
105
108
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command again resume' -d Repeat\ last\ entry\ matching\ tags
|
109
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command again resume' -d Force\ exact\ search\ string\ matching
|
106
110
|
complete -c doing -l before -f -r -n '__fish_doing_using_command archive move' -d Archive\ entries\ older\ than\ date
|
107
111
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command archive move' -d Tag\ boolean
|
112
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command archive move' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
108
113
|
complete -c doing -l keep -s k -f -r -n '__fish_doing_using_command archive move' -d How\ many\ items\ to\ keep
|
109
114
|
complete -c doing -l label -f -n '__fish_doing_using_command archive move' -d Label\ moved\ items\ with\ @from\(SECTION_NAME\)
|
115
|
+
complete -c doing -l not -f -n '__fish_doing_using_command archive move' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string
|
110
116
|
complete -c doing -l search -f -r -n '__fish_doing_using_command archive move' -d Search\ filter
|
111
117
|
complete -c doing -l to -s t -f -r -n '__fish_doing_using_command archive move' -d Move\ entries\ to
|
112
118
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command archive move' -d Tag\ filter
|
119
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command archive move' -d Force\ exact\ search\ string\ matching
|
113
120
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command autotag' -d Boolean
|
114
121
|
complete -c doing -l count -s c -f -r -n '__fish_doing_using_command autotag' -d How\ many\ recent\ entries\ to\ autotag
|
115
122
|
complete -c doing -l force -f -n '__fish_doing_using_command autotag' -d Don\'t\ ask\ permission\ to\ autotag\ all\ entries\ when\ count\ is\ 0
|
@@ -120,10 +127,16 @@ complete -c doing -l tag -f -r -n '__fish_doing_using_command autotag' -d Autot
|
|
120
127
|
complete -c doing -l unfinished -s u -f -n '__fish_doing_using_command autotag' -d Autotag\ last\ entry
|
121
128
|
complete -c doing -l archive -s a -f -n '__fish_doing_using_command cancel' -d Archive\ entries
|
122
129
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command cancel' -d Boolean
|
130
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command cancel' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
123
131
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command cancel' -d Select\ item\(s\)\ to\ cancel\ from\ a\ menu\ of\ matching\ entries
|
132
|
+
complete -c doing -l not -f -n '__fish_doing_using_command cancel' -d Finish\ items\ that\ \*don\'t\*\ match\ search/tag\ filters
|
124
133
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command cancel' -d Section
|
134
|
+
complete -c doing -l search -f -r -n '__fish_doing_using_command cancel' -d Cancel\ the\ last\ X\ entries\ matching\ search\ filter
|
125
135
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command cancel' -d Cancel\ the\ last\ X\ entries\ containing\ TAG
|
126
136
|
complete -c doing -l unfinished -s u -f -n '__fish_doing_using_command cancel' -d Cancel\ last\ entry
|
137
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command cancel' -d Force\ exact\ search\ string\ matching
|
138
|
+
complete -c doing -l file -s f -f -r -n '__fish_doing_using_command completion' -d File\ to\ write\ output\ to
|
139
|
+
complete -c doing -l type -s t -f -r -n '__fish_doing_using_command completion' -d Shell\ to\ generate\ for
|
127
140
|
complete -c doing -F -n '__fish_doing_using_command config'
|
128
141
|
complete -c doing -l dump -s d -f -n '__fish_doing_using_command config' -d Show\ a\ config\ key\ value\ based\ on\ arguments
|
129
142
|
complete -c doing -l editor -s e -f -r -n '__fish_doing_using_command config' -d Editor\ to\ use
|
@@ -144,28 +157,36 @@ complete -c doing -l at -f -r -n '__fish_doing_using_command finish' -d Set\ fi
|
|
144
157
|
complete -c doing -l auto -f -n '__fish_doing_using_command finish' -d Auto-generate\ finish\ dates\ from\ next\ entry\'s\ start\ time
|
145
158
|
complete -c doing -l back -s b -f -r -n '__fish_doing_using_command finish' -d Backdate\ completed\ date\ to\ date\ string\ \[4pm\|20m\|2h\|yesterday\ noon\]
|
146
159
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command finish' -d Boolean
|
160
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command finish' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
147
161
|
complete -c doing -l date -f -n '__fish_doing_using_command finish' -d Include\ date
|
148
162
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command finish' -d Select\ item\(s\)\ to\ finish\ from\ a\ menu\ of\ matching\ entries
|
163
|
+
complete -c doing -l not -f -n '__fish_doing_using_command finish' -d Finish\ items\ that\ \*don\'t\*\ match\ search/tag\ filters
|
149
164
|
complete -c doing -l remove -s r -f -n '__fish_doing_using_command finish' -d Remove\ done\ tag
|
150
165
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command finish' -d Section
|
151
166
|
complete -c doing -l search -f -r -n '__fish_doing_using_command finish' -d Finish\ the\ last\ X\ entries\ matching\ search\ filter
|
152
167
|
complete -c doing -l took -s t -f -r -n '__fish_doing_using_command finish' -d Set\ the\ completed\ date\ to\ the\ start\ date\ plus\ XX\[hmd\]
|
153
168
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command finish' -d Finish\ the\ last\ X\ entries\ containing\ TAG
|
154
169
|
complete -c doing -l unfinished -s u -f -n '__fish_doing_using_command finish' -d Finish\ last\ entry
|
170
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command finish' -d Force\ exact\ search\ string\ matching
|
155
171
|
complete -c doing -l after -f -r -n '__fish_doing_using_command grep search' -d Constrain\ search\ to\ entries\ newer\ than\ date
|
156
172
|
complete -c doing -l before -f -r -n '__fish_doing_using_command grep search' -d Constrain\ search\ to\ entries\ older\ than\ date
|
173
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command grep search' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
157
174
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command grep search' -d Display\ an\ interactive\ menu\ of\ results\ to\ perform\ further\ operations
|
175
|
+
complete -c doing -l not -f -n '__fish_doing_using_command grep search' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string
|
158
176
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command grep search' -d Output\ to\ export\ format
|
159
177
|
complete -c doing -l only_timed -f -n '__fish_doing_using_command grep search' -d Only\ show\ items\ with\ recorded\ time\ intervals
|
160
178
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command grep search' -d Section
|
161
179
|
complete -c doing -l times -s t -f -n '__fish_doing_using_command grep search' -d Show\ time\ intervals\ on\ @done\ tasks
|
162
180
|
complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command grep search' -d Sort\ tags\ by
|
163
181
|
complete -c doing -l totals -f -n '__fish_doing_using_command grep search' -d Show\ intervals\ with\ totals\ at\ the\ end\ of\ output
|
182
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command grep search' -d Force\ exact\ string\ matching
|
164
183
|
complete -c doing -F -n '__fish_doing_using_command import'
|
165
184
|
complete -c doing -l after -f -r -n '__fish_doing_using_command import' -d Import\ entries\ newer\ than\ date
|
166
185
|
complete -c doing -l autotag -f -n '__fish_doing_using_command import' -d Autotag\ entries
|
167
186
|
complete -c doing -l before -f -r -n '__fish_doing_using_command import' -d Import\ entries\ older\ than\ date
|
187
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command import' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
168
188
|
complete -c doing -l from -s f -f -r -n '__fish_doing_using_command import' -d Date\ range\ to\ import
|
189
|
+
complete -c doing -l not -f -n '__fish_doing_using_command import' -d Import\ items\ that\ \*don\'t\*\ match\ search/tag/date\ filters
|
169
190
|
complete -c doing -l only_timed -f -n '__fish_doing_using_command import' -d Only\ import\ items\ with\ recorded\ time\ intervals
|
170
191
|
complete -c doing -l overlap -f -n '__fish_doing_using_command import' -d Allow\ entries\ that\ overlap\ existing\ times
|
171
192
|
complete -c doing -l prefix -f -r -n '__fish_doing_using_command import' -d Prefix\ entries\ with
|
@@ -173,36 +194,46 @@ complete -c doing -l section -s s -f -r -n '__fish_doing_using_command import' -
|
|
173
194
|
complete -c doing -l search -f -r -n '__fish_doing_using_command import' -d Only\ import\ items\ matching\ search
|
174
195
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command import' -d Tag\ all\ imported\ entries
|
175
196
|
complete -c doing -l type -f -r -n '__fish_doing_using_command import' -d Import\ type
|
197
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command import' -d Force\ exact\ search\ string\ matching
|
176
198
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command last' -d Tag\ boolean
|
199
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command last' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
177
200
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command last' -d Edit\ entry\ with\ vim
|
201
|
+
complete -c doing -l not -f -n '__fish_doing_using_command last' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string\ or\ tag\ filter
|
178
202
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command last' -d Specify\ a\ section
|
179
203
|
complete -c doing -l search -f -r -n '__fish_doing_using_command last' -d Search\ filter
|
180
204
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command last' -d Tag\ filter
|
205
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command last' -d Force\ exact\ search\ string\ matching
|
181
206
|
complete -c doing -l back -s b -f -r -n '__fish_doing_using_command later' -d Backdate\ start\ time\ to\ date\ string\ \[4pm\|20m\|2h\|yesterday\ noon\]
|
182
207
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command later' -d Edit\ entry\ with\ vim
|
183
208
|
complete -c doing -l note -s n -f -r -n '__fish_doing_using_command later' -d Note
|
184
209
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command mark flag' -d Boolean
|
185
210
|
complete -c doing -l count -s c -f -r -n '__fish_doing_using_command mark flag' -d How\ many\ recent\ entries\ to\ tag
|
211
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command mark flag' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
186
212
|
complete -c doing -l date -s d -f -n '__fish_doing_using_command mark flag' -d Include\ current\ date/time\ with\ tag
|
187
213
|
complete -c doing -l force -f -n '__fish_doing_using_command mark flag' -d Don\'t\ ask\ permission\ to\ flag\ all\ entries\ when\ count\ is\ 0
|
188
214
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command mark flag' -d Select\ item\(s\)\ to\ flag\ from\ a\ menu\ of\ matching\ entries
|
215
|
+
complete -c doing -l not -f -n '__fish_doing_using_command mark flag' -d Flag\ items\ that\ \*don\'t\*\ match\ search/tag/date\ filters
|
189
216
|
complete -c doing -l remove -s r -f -n '__fish_doing_using_command mark flag' -d Remove\ flag
|
190
217
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command mark flag' -d Section
|
191
218
|
complete -c doing -l search -f -r -n '__fish_doing_using_command mark flag' -d Flag\ the\ last\ entry\ matching\ search\ filter
|
192
219
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command mark flag' -d Flag\ the\ last\ entry\ containing\ TAG
|
193
220
|
complete -c doing -l unfinished -s u -f -n '__fish_doing_using_command mark flag' -d Flag\ last\ entry
|
221
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command mark flag' -d Force\ exact\ search\ string\ matching
|
194
222
|
complete -c doing -l archive -s a -f -n '__fish_doing_using_command meanwhile' -d Archive\ previous\ @meanwhile\ entry
|
195
223
|
complete -c doing -l back -s b -f -r -n '__fish_doing_using_command meanwhile' -d Backdate\ start\ date\ for\ new\ entry\ to\ date\ string\ \[4pm\|20m\|2h\|yesterday\ noon\]
|
196
224
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command meanwhile' -d Edit\ entry\ with\ vim
|
197
225
|
complete -c doing -l note -s n -f -r -n '__fish_doing_using_command meanwhile' -d Note
|
198
226
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command meanwhile' -d Section
|
199
227
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command note' -d Boolean
|
228
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command note' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
200
229
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command note' -d Edit\ entry\ with\ vim
|
201
230
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command note' -d Select\ item\ for\ new\ note\ from\ a\ menu\ of\ matching\ entries
|
231
|
+
complete -c doing -l not -f -n '__fish_doing_using_command note' -d Add\ note\ to\ item\ that\ \*doesn\'t\*\ match\ search/tag\ filters
|
202
232
|
complete -c doing -l remove -s r -f -n '__fish_doing_using_command note' -d Replace/Remove\ last\ entry\'s\ note
|
203
233
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command note' -d Section
|
204
234
|
complete -c doing -l search -f -r -n '__fish_doing_using_command note' -d Add/remove\ note\ from\ last\ entry\ matching\ search\ filter
|
205
235
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command note' -d Add/remove\ note\ from\ last\ entry\ matching\ tag
|
236
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command note' -d Force\ exact\ search\ string\ matching
|
206
237
|
complete -c doing -l back -s b -f -r -n '__fish_doing_using_command now next' -d Backdate\ start\ time\ \[4pm\|20m\|2h\|yesterday\ noon\]
|
207
238
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command now next' -d Edit\ entry\ with\ vim
|
208
239
|
complete -c doing -l finish_last -s f -f -n '__fish_doing_using_command now next' -d Timed\ entry
|
@@ -223,21 +254,28 @@ complete -c doing -l times -s t -f -n '__fish_doing_using_command recent' -d Sh
|
|
223
254
|
complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command recent' -d Sort\ tags\ by
|
224
255
|
complete -c doing -l totals -f -n '__fish_doing_using_command recent' -d Show\ intervals\ with\ totals\ at\ the\ end\ of\ output
|
225
256
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command reset begin' -d Boolean
|
257
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command reset begin' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
226
258
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command reset begin' -d Select\ from\ a\ menu\ of\ matching\ entries
|
259
|
+
complete -c doing -l not -f -n '__fish_doing_using_command reset begin' -d Reset\ items\ that\ \*don\'t\*\ match\ search/tag\ filters
|
227
260
|
complete -c doing -l resume -s r -f -n '__fish_doing_using_command reset begin' -d Resume\ entry
|
228
|
-
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command reset begin' -d
|
261
|
+
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command reset begin' -d Limit\ search\ to\ section
|
229
262
|
complete -c doing -l search -f -r -n '__fish_doing_using_command reset begin' -d Reset\ last\ entry\ matching\ search\ filter
|
230
263
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command reset begin' -d Reset\ last\ entry\ matching\ tag
|
264
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command reset begin' -d Force\ exact\ search\ string\ matching
|
231
265
|
complete -c doing -l before -f -r -n '__fish_doing_using_command rotate' -d Rotate\ entries\ older\ than\ date
|
232
266
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command rotate' -d Tag\ boolean
|
267
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command rotate' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
233
268
|
complete -c doing -l keep -s k -f -r -n '__fish_doing_using_command rotate' -d How\ many\ items\ to\ keep\ in\ each\ section
|
269
|
+
complete -c doing -l not -f -n '__fish_doing_using_command rotate' -d Rotate\ items\ that\ \*don\'t\*\ match\ search\ string\ or\ tag\ filter
|
234
270
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command rotate' -d Section\ to\ rotate
|
235
271
|
complete -c doing -l search -f -r -n '__fish_doing_using_command rotate' -d Search\ filter
|
236
272
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command rotate' -d Tag\ filter
|
273
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command rotate' -d Force\ exact\ search\ string\ matching
|
237
274
|
complete -c doing -l column -s c -f -n '__fish_doing_using_command sections' -d List\ in\ single\ column
|
238
275
|
complete -c doing -l archive -s a -f -n '__fish_doing_using_command select' -d Archive\ selected\ items
|
239
276
|
complete -c doing -l resume -f -n '__fish_doing_using_command select' -d Copy\ selection\ as\ a\ new\ entry\ with\ current\ time\ and\ no\ @done\ tag
|
240
277
|
complete -c doing -l cancel -s c -f -n '__fish_doing_using_command select' -d Cancel\ selected\ items
|
278
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command select' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
241
279
|
complete -c doing -l delete -s d -f -n '__fish_doing_using_command select' -d Delete\ selected\ items
|
242
280
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command select' -d Edit\ selected\ item\(s\)
|
243
281
|
complete -c doing -l finish -s f -f -n '__fish_doing_using_command select' -d Add\ @done\ with\ current\ time\ to\ selected\ item\(s\)
|
@@ -245,19 +283,23 @@ complete -c doing -l flag -f -n '__fish_doing_using_command select' -d Add\ fl
|
|
245
283
|
complete -c doing -l force -f -n '__fish_doing_using_command select' -d Perform\ action\ without\ confirmation
|
246
284
|
complete -c doing -l move -s m -f -r -n '__fish_doing_using_command select' -d Move\ selected\ items\ to\ section
|
247
285
|
complete -c doing -l menu -f -n '__fish_doing_using_command select' -d Use\ --no-menu\ to\ skip\ the\ interactive\ menu
|
286
|
+
complete -c doing -l not -f -n '__fish_doing_using_command select' -d Select\ items\ that\ \*don\'t\*\ match\ search/tag\ filters
|
248
287
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command select' -d Output\ entries\ to\ format
|
249
288
|
complete -c doing -l search -f -r -n '__fish_doing_using_command select' -d Initial\ search\ query\ for\ filtering
|
250
289
|
complete -c doing -l remove -s r -f -n '__fish_doing_using_command select' -d Reverse\ -c
|
251
290
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command select' -d Select\ from\ a\ specific\ section
|
252
291
|
complete -c doing -l save_to -f -r -n '__fish_doing_using_command select' -d Save\ selected\ entries\ to\ file\ using\ --output\ format
|
253
292
|
complete -c doing -l tag -s t -f -r -n '__fish_doing_using_command select' -d Tag\ selected\ entries
|
293
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command select' -d Force\ exact\ search\ string\ matching
|
254
294
|
complete -c doing -l age -s a -f -r -n '__fish_doing_using_command show' -d Age
|
255
295
|
complete -c doing -l after -f -r -n '__fish_doing_using_command show' -d View\ entries\ newer\ than\ date
|
256
296
|
complete -c doing -l bool -s b -f -r -n '__fish_doing_using_command show' -d Tag\ boolean
|
257
297
|
complete -c doing -l before -f -r -n '__fish_doing_using_command show' -d View\ entries\ older\ than\ date
|
258
298
|
complete -c doing -l count -s c -f -r -n '__fish_doing_using_command show' -d Max\ count\ to\ show
|
299
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command show' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
259
300
|
complete -c doing -l from -s f -f -r -n '__fish_doing_using_command show' -d Date\ range\ to\ show
|
260
301
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command show' -d Select\ from\ a\ menu\ of\ matching\ entries\ to\ perform\ additional\ operations
|
302
|
+
complete -c doing -l not -f -n '__fish_doing_using_command show' -d Show\ items\ that\ \*don\'t\*\ match\ search/tag/date\ filters
|
261
303
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command show' -d Output\ to\ export\ format
|
262
304
|
complete -c doing -l only_timed -f -n '__fish_doing_using_command show' -d Only\ show\ items\ with\ recorded\ time\ intervals
|
263
305
|
complete -c doing -l sort -s s -f -r -n '__fish_doing_using_command show' -d Sort\ order
|
@@ -267,6 +309,7 @@ complete -c doing -l tag -f -r -n '__fish_doing_using_command show' -d Tag\ fil
|
|
267
309
|
complete -c doing -l tag_order -f -r -n '__fish_doing_using_command show' -d Tag\ sort\ direction
|
268
310
|
complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command show' -d Sort\ tags\ by
|
269
311
|
complete -c doing -l totals -f -n '__fish_doing_using_command show' -d Show\ intervals\ with\ totals\ at\ the\ end\ of\ output
|
312
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command show' -d Force\ exact\ search\ string\ matching
|
270
313
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command since' -d Output\ to\ export\ format
|
271
314
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command since' -d Section
|
272
315
|
complete -c doing -l times -s t -f -n '__fish_doing_using_command since' -d Show\ time\ intervals\ on\ @done\ tasks
|
@@ -275,9 +318,11 @@ complete -c doing -l totals -f -n '__fish_doing_using_command since' -d Show\
|
|
275
318
|
complete -c doing -l autotag -s a -f -n '__fish_doing_using_command tag' -d Autotag\ entries\ based\ on\ autotag\ configuration\ in\ \~/
|
276
319
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command tag' -d Boolean
|
277
320
|
complete -c doing -l count -s c -f -r -n '__fish_doing_using_command tag' -d How\ many\ recent\ entries\ to\ tag
|
321
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command tag' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
278
322
|
complete -c doing -l date -s d -f -n '__fish_doing_using_command tag' -d Include\ current\ date/time\ with\ tag
|
279
323
|
complete -c doing -l force -f -n '__fish_doing_using_command tag' -d Don\'t\ ask\ permission\ to\ tag\ all\ entries\ when\ count\ is\ 0
|
280
324
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command tag' -d Select\ item\(s\)\ to\ tag\ from\ a\ menu\ of\ matching\ entries
|
325
|
+
complete -c doing -l not -f -n '__fish_doing_using_command tag' -d Tag\ items\ that\ \*don\'t\*\ match\ search/tag\ filters
|
281
326
|
complete -c doing -l remove -s r -f -n '__fish_doing_using_command tag' -d Remove\ given\ tag\(s\)
|
282
327
|
complete -c doing -l regex -f -n '__fish_doing_using_command tag' -d Interpret\ tag\ string\ as\ regular\ expression
|
283
328
|
complete -c doing -l rename -f -r -n '__fish_doing_using_command tag' -d Replace\ existing\ tag\ with\ tag\ argument
|
@@ -285,6 +330,7 @@ complete -c doing -l section -s s -f -r -n '__fish_doing_using_command tag' -d S
|
|
285
330
|
complete -c doing -l search -f -r -n '__fish_doing_using_command tag' -d Tag\ entries\ matching\ search\ filter
|
286
331
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command tag' -d Tag\ the\ last\ X\ entries\ containing\ TAG
|
287
332
|
complete -c doing -l unfinished -s u -f -n '__fish_doing_using_command tag' -d Tag\ last\ entry
|
333
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command tag' -d Force\ exact\ search\ string\ matching
|
288
334
|
complete -c doing -l list -s l -f -n '__fish_doing_using_command template' -d List\ all\ available\ templates
|
289
335
|
complete -c doing -l after -f -r -n '__fish_doing_using_command today' -d View\ entries\ after\ specified\ time
|
290
336
|
complete -c doing -l before -f -r -n '__fish_doing_using_command today' -d View\ entries\ before\ specified\ time
|
@@ -298,8 +344,10 @@ complete -c doing -l after -f -r -n '__fish_doing_using_command view' -d View\
|
|
298
344
|
complete -c doing -l bool -s b -f -r -n '__fish_doing_using_command view' -d Tag\ boolean
|
299
345
|
complete -c doing -l before -f -r -n '__fish_doing_using_command view' -d View\ entries\ older\ than\ date
|
300
346
|
complete -c doing -l count -s c -f -r -n '__fish_doing_using_command view' -d Count\ to\ display
|
347
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command view' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
301
348
|
complete -c doing -l color -f -n '__fish_doing_using_command view' -d Include\ colors\ in\ output
|
302
349
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command view' -d Select\ from\ a\ menu\ of\ matching\ entries\ to\ perform\ additional\ operations
|
350
|
+
complete -c doing -l not -f -n '__fish_doing_using_command view' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string
|
303
351
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command view' -d Output\ to\ export\ format
|
304
352
|
complete -c doing -l only_timed -f -n '__fish_doing_using_command view' -d Only\ show\ items\ with\ recorded\ time\ intervals
|
305
353
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command view' -d Section
|
@@ -309,6 +357,7 @@ complete -c doing -l tag -f -r -n '__fish_doing_using_command view' -d Tag\ fil
|
|
309
357
|
complete -c doing -l tag_order -f -r -n '__fish_doing_using_command view' -d Tag\ sort\ direction
|
310
358
|
complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command view' -d Sort\ tags\ by
|
311
359
|
complete -c doing -l totals -f -n '__fish_doing_using_command view' -d Show\ intervals\ with\ totals\ at\ the\ end\ of\ output
|
360
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command view' -d Force\ exact\ search\ string\ matching
|
312
361
|
complete -c doing -l column -s c -f -n '__fish_doing_using_command views' -d List\ in\ single\ column
|
313
362
|
complete -c doing -l after -f -r -n '__fish_doing_using_command wiki' -d Include\ entries\ newer\ than\ date
|
314
363
|
complete -c doing -l bool -s b -f -r -n '__fish_doing_using_command wiki' -d Tag\ boolean
|
data/lib/doing/array.rb
CHANGED
@@ -4,5 +4,18 @@ module Doing
|
|
4
4
|
##
|
5
5
|
## Array helpers
|
6
6
|
##
|
7
|
-
class ::Array
|
7
|
+
class ::Array
|
8
|
+
def to_tags
|
9
|
+
map { |t| t.sub(/^@?/, '@') }
|
10
|
+
end
|
11
|
+
|
12
|
+
def highlight_tags(color = 'cyan')
|
13
|
+
tag_color = Doing::Color.send(color)
|
14
|
+
to_tags.map { |t| "#{tag_color}#{t}" }
|
15
|
+
end
|
16
|
+
|
17
|
+
def log_tags
|
18
|
+
highlight_tags.join(', ')
|
19
|
+
end
|
20
|
+
end
|
8
21
|
end
|
data/lib/doing/item.rb
CHANGED
@@ -5,7 +5,7 @@ module Doing
|
|
5
5
|
## This class describes a single WWID item
|
6
6
|
##
|
7
7
|
class Item
|
8
|
-
include Amatch
|
8
|
+
# include Amatch
|
9
9
|
|
10
10
|
attr_accessor :date, :title, :section, :note
|
11
11
|
|
@@ -161,22 +161,23 @@ module Doing
|
|
161
161
|
##
|
162
162
|
def search(search, distance: 3, negate: false, case_type: :smart, fuzzy: false)
|
163
163
|
text = @title + @note.to_s
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
end
|
164
|
+
matches = text =~ search.to_rx(distance: distance, case_type: case_type)
|
165
|
+
|
166
|
+
# if search.is_rx? || !fuzzy
|
167
|
+
# matches = text =~ search.to_rx(distance: distance, case_type: case_type)
|
168
|
+
# else
|
169
|
+
# distance = 0.25 if distance > 1
|
170
|
+
# score = if (case_type == :smart && search !~ /[A-Z]/) || case_type == :ignore
|
171
|
+
# text.downcase.pair_distance_similar(search.downcase)
|
172
|
+
# else
|
173
|
+
# score = text.pair_distance_similar(search)
|
174
|
+
# end
|
175
|
+
|
176
|
+
# if score >= distance
|
177
|
+
# matches = true
|
178
|
+
# Doing.logger.debug('Fuzzy Match:', %(#{@title}, "#{search}" #{score}))
|
179
|
+
# end
|
180
|
+
# end
|
180
181
|
|
181
182
|
negate ? !matches : matches
|
182
183
|
end
|
data/lib/doing/log_adapter.rb
CHANGED
@@ -19,16 +19,17 @@ module Doing
|
|
19
19
|
}.freeze
|
20
20
|
|
21
21
|
COUNT_KEYS = %i[
|
22
|
-
added_tags
|
23
|
-
removed_tags
|
24
22
|
added
|
25
|
-
|
26
|
-
deleted
|
27
|
-
completed
|
23
|
+
added_tags
|
28
24
|
archived
|
29
|
-
|
25
|
+
autotag
|
26
|
+
completed
|
30
27
|
completed_archived
|
28
|
+
deleted
|
29
|
+
moved
|
30
|
+
removed_tags
|
31
31
|
skipped
|
32
|
+
updated
|
32
33
|
].freeze
|
33
34
|
|
34
35
|
#
|
@@ -242,6 +243,8 @@ module Doing
|
|
242
243
|
|
243
244
|
def format_counter(key, data)
|
244
245
|
case key
|
246
|
+
when :autotag
|
247
|
+
['Autotag:', data[:message] || 'autotagged %count %items']
|
245
248
|
when :added_tags
|
246
249
|
['Tagged:', data[:message] || 'added %tags to %count %items']
|
247
250
|
when :removed_tags
|
data/lib/doing/string.rb
CHANGED
@@ -279,7 +279,7 @@ module Doing
|
|
279
279
|
|
280
280
|
def add_tags(tags, remove: false)
|
281
281
|
title = self.dup
|
282
|
-
tags = tags.to_tags
|
282
|
+
tags = tags.to_tags
|
283
283
|
tags.each { |tag| title.tag!(tag, remove: remove) }
|
284
284
|
title
|
285
285
|
end
|
@@ -353,7 +353,7 @@ module Doing
|
|
353
353
|
|
354
354
|
def dedup_tags
|
355
355
|
title = dup
|
356
|
-
tags = title.scan(/(
|
356
|
+
tags = title.scan(/(?<=\A| )(@(\S+?)(\([^)]+\))?)(?= |\Z)/).uniq
|
357
357
|
tags.each do |tag|
|
358
358
|
found = false
|
359
359
|
title.gsub!(/( |^)#{tag[1]}(\([^)]+\))?(?= |$)/) do |m|
|
data/lib/doing/version.rb
CHANGED
data/lib/doing/wwid.rb
CHANGED
@@ -1637,13 +1637,20 @@ module Doing
|
|
1637
1637
|
## @param opt [Hash] Additional Options
|
1638
1638
|
##
|
1639
1639
|
def list_section(opt = {})
|
1640
|
+
opt[:config_template] ||= 'default'
|
1641
|
+
cfg = @config.dig('templates', opt[:config_template]).deep_merge({
|
1642
|
+
'wrap_width' => @config['wrap_width'] || 0,
|
1643
|
+
'date_format' => @config['default_date_format'],
|
1644
|
+
'order' => @config['order'] || 'asc',
|
1645
|
+
'tags_color' => @config['tags_color']
|
1646
|
+
})
|
1640
1647
|
opt[:count] ||= 0
|
1641
1648
|
opt[:age] ||= 'newest'
|
1642
|
-
opt[:format] ||=
|
1643
|
-
opt[:order] ||=
|
1649
|
+
opt[:format] ||= cfg['date_format']
|
1650
|
+
opt[:order] ||= cfg['order'] || 'asc'
|
1644
1651
|
opt[:tag_order] ||= 'asc'
|
1645
|
-
opt[:tags_color] ||= false
|
1646
|
-
opt[:template] ||=
|
1652
|
+
opt[:tags_color] ||= cfg['tags_color'] || false
|
1653
|
+
opt[:template] ||= cfg['template']
|
1647
1654
|
|
1648
1655
|
# opt[:highlight] ||= true
|
1649
1656
|
title = ''
|
@@ -1684,7 +1691,7 @@ module Doing
|
|
1684
1691
|
|
1685
1692
|
opt[:output] ||= 'template'
|
1686
1693
|
|
1687
|
-
opt[:wrap_width] ||= @config['templates']['default']['wrap_width']
|
1694
|
+
opt[:wrap_width] ||= @config['templates']['default']['wrap_width'] || 0
|
1688
1695
|
|
1689
1696
|
output(items, title, is_single, opt)
|
1690
1697
|
end
|
@@ -1729,13 +1736,18 @@ module Doing
|
|
1729
1736
|
opt[:totals] ||= false
|
1730
1737
|
opt[:sort_tags] ||= false
|
1731
1738
|
|
1732
|
-
cfg = @config['templates']['today']
|
1739
|
+
cfg = @config['templates']['today'].deep_merge(@config['templates']['default']).deep_merge({
|
1740
|
+
'wrap_width' => @config['wrap_width'] || 0,
|
1741
|
+
'date_format' => @config['default_date_format'],
|
1742
|
+
'order' => @config['order'] || 'asc',
|
1743
|
+
'tags_color' => @config['tags_color']
|
1744
|
+
})
|
1733
1745
|
options = {
|
1734
1746
|
after: opt[:after],
|
1735
1747
|
before: opt[:before],
|
1736
1748
|
count: 0,
|
1737
1749
|
format: cfg['date_format'],
|
1738
|
-
order: 'asc',
|
1750
|
+
order: cfg['order'] || 'asc',
|
1739
1751
|
output: output,
|
1740
1752
|
section: opt[:section],
|
1741
1753
|
sort_tags: opt[:sort_tags],
|
@@ -1743,7 +1755,9 @@ module Doing
|
|
1743
1755
|
times: times,
|
1744
1756
|
today: true,
|
1745
1757
|
totals: opt[:totals],
|
1746
|
-
wrap_width: cfg['wrap_width']
|
1758
|
+
wrap_width: cfg['wrap_width'],
|
1759
|
+
tags_color: cfg['tags_color'],
|
1760
|
+
config_template: 'today'
|
1747
1761
|
}
|
1748
1762
|
list_section(options)
|
1749
1763
|
end
|
@@ -1765,7 +1779,7 @@ module Doing
|
|
1765
1779
|
dates = [dates, dates] if dates.instance_of?(String)
|
1766
1780
|
|
1767
1781
|
list_section({ section: section, count: 0, order: 'asc', date_filter: dates, times: times,
|
1768
|
-
output: output, totals: opt[:totals], sort_tags: opt[:sort_tags] })
|
1782
|
+
output: output, totals: opt[:totals], sort_tags: opt[:sort_tags], config_template: 'default' })
|
1769
1783
|
end
|
1770
1784
|
|
1771
1785
|
##
|
@@ -1795,7 +1809,8 @@ module Doing
|
|
1795
1809
|
tag_order: opt[:tag_order],
|
1796
1810
|
times: times,
|
1797
1811
|
totals: opt[:totals],
|
1798
|
-
yesterday: true
|
1812
|
+
yesterday: true,
|
1813
|
+
config_template: 'today'
|
1799
1814
|
}
|
1800
1815
|
|
1801
1816
|
list_section(options)
|
@@ -1813,14 +1828,19 @@ module Doing
|
|
1813
1828
|
opt[:totals] ||= false
|
1814
1829
|
opt[:sort_tags] ||= false
|
1815
1830
|
|
1816
|
-
cfg = @config['templates']['recent']
|
1831
|
+
cfg = @config['templates']['recent'].deep_merge(@config['templates']['default']).deep_merge({
|
1832
|
+
'wrap_width' => @config['wrap_width'] || 0,
|
1833
|
+
'date_format' => @config['default_date_format'],
|
1834
|
+
'order' => @config['order'] || 'asc',
|
1835
|
+
'tags_color' => @config['tags_color']
|
1836
|
+
})
|
1817
1837
|
section ||= @config['current_section']
|
1818
1838
|
section = guess_section(section)
|
1819
1839
|
|
1820
1840
|
list_section({ section: section, wrap_width: cfg['wrap_width'], count: count,
|
1821
1841
|
format: cfg['date_format'], template: cfg['template'],
|
1822
1842
|
order: 'asc', times: times, totals: opt[:totals],
|
1823
|
-
sort_tags: opt[:sort_tags], tags_color: opt[:tags_color] })
|
1843
|
+
sort_tags: opt[:sort_tags], tags_color: opt[:tags_color], config_template: 'recent' })
|
1824
1844
|
end
|
1825
1845
|
|
1826
1846
|
##
|
@@ -1831,7 +1851,12 @@ module Doing
|
|
1831
1851
|
##
|
1832
1852
|
def last(times: true, section: nil, options: {})
|
1833
1853
|
section = section.nil? || section =~ /all/i ? 'All' : guess_section(section)
|
1834
|
-
cfg = @config['templates']['last']
|
1854
|
+
cfg = @config['templates']['last'].deep_merge(@config['templates']['default']).deep_merge({
|
1855
|
+
'wrap_width' => @config['wrap_width'] || 0,
|
1856
|
+
'date_format' => @config['default_date_format'],
|
1857
|
+
'order' => @config['order'] || 'asc',
|
1858
|
+
'tags_color' => @config['tags_color']
|
1859
|
+
})
|
1835
1860
|
|
1836
1861
|
opts = {
|
1837
1862
|
section: section,
|
@@ -1852,6 +1877,7 @@ module Doing
|
|
1852
1877
|
opts[:search] = options[:search] if options[:search]
|
1853
1878
|
opts[:case] = options[:case]
|
1854
1879
|
opts[:not] = options[:negate]
|
1880
|
+
opts[:config_template] = 'last'
|
1855
1881
|
list_section(opts)
|
1856
1882
|
end
|
1857
1883
|
|
@@ -1868,68 +1894,90 @@ module Doing
|
|
1868
1894
|
|
1869
1895
|
original = text.dup
|
1870
1896
|
|
1871
|
-
current_tags = text.scan(/@\w+/)
|
1872
|
-
|
1897
|
+
current_tags = text.scan(/@\w+/).map { |t| t.sub(/^@/, '') }
|
1898
|
+
tagged = {
|
1899
|
+
whitelisted: [],
|
1900
|
+
synonyms: [],
|
1901
|
+
transformed: [],
|
1902
|
+
replaced: []
|
1903
|
+
}
|
1904
|
+
|
1873
1905
|
@config['autotag']['whitelist'].each do |tag|
|
1874
1906
|
next if text =~ /@#{tag}\b/i
|
1875
1907
|
|
1876
|
-
text.sub!(/(
|
1877
|
-
m.downcase!
|
1878
|
-
whitelisted.push(
|
1908
|
+
text.sub!(/(?<= |\A)(#{tag.strip})(?= |\Z)/i) do |m|
|
1909
|
+
m.downcase! unless tag =~ /[A-Z]/
|
1910
|
+
tagged[:whitelisted].push(m)
|
1879
1911
|
"@#{m}"
|
1880
1912
|
end
|
1881
1913
|
end
|
1882
|
-
|
1914
|
+
|
1883
1915
|
@config['autotag']['synonyms'].each do |tag, v|
|
1884
1916
|
v.each do |word|
|
1885
1917
|
next unless text =~ /\b#{word}\b/i
|
1886
1918
|
|
1887
|
-
|
1919
|
+
unless current_tags.include?(tag) || tagged[:whitelisted].include?(tag)
|
1920
|
+
tagged[:synonyms].push(tag)
|
1921
|
+
tagged[:synonyms] = tagged[:synonyms].uniq
|
1922
|
+
end
|
1888
1923
|
end
|
1889
1924
|
end
|
1925
|
+
|
1890
1926
|
if @config['autotag'].key? 'transform'
|
1891
1927
|
@config['autotag']['transform'].each do |tag|
|
1892
1928
|
next unless tag =~ /\S+:\S+/
|
1893
1929
|
|
1894
1930
|
rx, r = tag.split(/:/)
|
1931
|
+
flag_rx = %r{/([r]+)$}
|
1932
|
+
if r =~ flag_rx
|
1933
|
+
flags = r.match(flag_rx)[1].split(//)
|
1934
|
+
r.sub!(flag_rx, '')
|
1935
|
+
end
|
1895
1936
|
r.gsub!(/\$/, '\\')
|
1896
|
-
rx.sub!(
|
1897
|
-
regex = Regexp.new(
|
1898
|
-
|
1899
|
-
matches = text.scan(regex)
|
1900
|
-
next unless matches
|
1937
|
+
rx.sub!(/^@?/, '@')
|
1938
|
+
regex = Regexp.new("(?<= |\\A)#{rx}(?= |\\Z)")
|
1901
1939
|
|
1902
|
-
|
1940
|
+
text.sub!(regex) do
|
1941
|
+
m = Regexp.last_match
|
1903
1942
|
new_tag = r
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1943
|
+
|
1944
|
+
m.to_a.slice(1, m.length - 1).each_with_index do |v, idx|
|
1945
|
+
new_tag.gsub!("\\#{idx + 1}", v)
|
1946
|
+
end
|
1947
|
+
# Replace original tag if /r
|
1948
|
+
if flags&.include?('r')
|
1949
|
+
tagged[:replaced].concat(new_tag.split(/ /).map { |t| t.sub(/^@/, '') })
|
1950
|
+
new_tag.split(/ /).map { |t| t.sub(/^@?/, '@') }.join(' ')
|
1951
|
+
else
|
1952
|
+
tagged[:transformed].concat(new_tag.split(/ /).map { |t| t.sub(/^@/, '') })
|
1953
|
+
tagged[:transformed] = tagged[:transformed].uniq
|
1954
|
+
m[0]
|
1910
1955
|
end
|
1911
|
-
tail_tags.push(new_tag)
|
1912
1956
|
end
|
1913
1957
|
end
|
1914
1958
|
end
|
1915
1959
|
|
1916
|
-
logger.debug('Autotag:', "whitelisted tags: #{whitelisted.join(', ')}") unless whitelisted.empty?
|
1917
|
-
new_tags = whitelisted
|
1918
|
-
unless tail_tags.empty?
|
1919
|
-
tags = tail_tags.uniq.map { |t| "@#{t}".cyan }.join(' ')
|
1920
|
-
logger.debug('Autotag:', "synonym tags: #{tags}")
|
1921
|
-
tags_a = tail_tags.map { |t| "@#{t}" }
|
1922
|
-
text.add_tags!(tags_a.join(' '))
|
1923
|
-
new_tags.concat(tags_a)
|
1924
|
-
end
|
1925
1960
|
|
1926
|
-
|
1927
|
-
|
1961
|
+
logger.debug('Autotag:', "whitelisted tags: #{tagged[:whitelisted].log_tags}") unless tagged[:whitelisted].empty?
|
1962
|
+
logger.debug('Autotag:', "synonyms: #{tagged[:synonyms].log_tags}") unless tagged[:synonyms].empty?
|
1963
|
+
logger.debug('Autotag:', "transforms: #{tagged[:transformed].log_tags}") unless tagged[:transformed].empty?
|
1964
|
+
logger.debug('Autotag:', "transform replaced: #{tagged[:replaced].log_tags}") unless tagged[:replaced].empty?
|
1965
|
+
|
1966
|
+
tail_tags = tagged[:synonyms].concat(tagged[:transformed])
|
1967
|
+
tail_tags.sort!
|
1968
|
+
tail_tags.uniq!
|
1969
|
+
|
1970
|
+
text.add_tags!(tail_tags) unless tail_tags.empty?
|
1971
|
+
|
1972
|
+
if text == original
|
1973
|
+
logger.debug('Autotag:', "no change to \"#{text}\"")
|
1928
1974
|
else
|
1929
|
-
|
1975
|
+
new_tags = tagged[:whitelisted].concat(tail_tags).concat(tagged[:replaced])
|
1976
|
+
logger.debug('Autotag:', "added #{new_tags.log_tags} to \"#{text}\"")
|
1977
|
+
logger.count(:autotag, level: :info, count: 1, message: 'autotag updated %count %items')
|
1930
1978
|
end
|
1931
1979
|
|
1932
|
-
text
|
1980
|
+
text.dedup_tags
|
1933
1981
|
end
|
1934
1982
|
|
1935
1983
|
##
|