doing 2.1.52 → 2.1.56

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +1 -1
  5. data/bin/commands/completion.rb +1 -1
  6. data/bin/commands/recent.rb +15 -18
  7. data/bin/commands/tag_dir.rb +1 -1
  8. data/docs/doc/Array.html +1 -1
  9. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  10. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  11. data/docs/doc/BooleanTermParser/Query.html +1 -1
  12. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  13. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  14. data/docs/doc/BooleanTermParser.html +1 -1
  15. data/docs/doc/Doing/ArrayCleanup.html +1 -1
  16. data/docs/doc/Doing/ArrayNestedHash.html +1 -1
  17. data/docs/doc/Doing/ArrayTags.html +1 -1
  18. data/docs/doc/Doing/CSVExport.html +1 -1
  19. data/docs/doc/Doing/CalendarImport.html +1 -1
  20. data/docs/doc/Doing/Change.html +1 -1
  21. data/docs/doc/Doing/Changes.html +1 -1
  22. data/docs/doc/Doing/ChronifyArray.html +1 -1
  23. data/docs/doc/Doing/ChronifyNumeric.html +1 -1
  24. data/docs/doc/Doing/ChronifyString.html +1 -1
  25. data/docs/doc/Doing/Color.html +1 -1
  26. data/docs/doc/Doing/Completion/BashCompletions.html +1 -1
  27. data/docs/doc/Doing/Completion/FigCompletions.html +1 -1
  28. data/docs/doc/Doing/Completion/FishCompletions.html +1 -1
  29. data/docs/doc/Doing/Completion/StringUtils.html +1 -1
  30. data/docs/doc/Doing/Completion/ZshCompletions.html +1 -1
  31. data/docs/doc/Doing/Completion.html +1 -1
  32. data/docs/doc/Doing/Configuration.html +1 -1
  33. data/docs/doc/Doing/DayOneRenderer.html +1 -1
  34. data/docs/doc/Doing/DayoneExport.html +1 -1
  35. data/docs/doc/Doing/DoingExport.html +1 -1
  36. data/docs/doc/Doing/DoingImport.html +1 -1
  37. data/docs/doc/Doing/Entry.html +1 -1
  38. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  39. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  40. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  41. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  42. data/docs/doc/Doing/Errors/HistoryLimitError.html +1 -1
  43. data/docs/doc/Doing/Errors/InvalidPlugin.html +1 -1
  44. data/docs/doc/Doing/Errors/MissingBackupFile.html +1 -1
  45. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  46. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  47. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  48. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  49. data/docs/doc/Doing/Errors.html +1 -1
  50. data/docs/doc/Doing/HTMLExport.html +1 -1
  51. data/docs/doc/Doing/Hooks.html +1 -1
  52. data/docs/doc/Doing/Item.html +2 -2
  53. data/docs/doc/Doing/ItemDates.html +1 -1
  54. data/docs/doc/Doing/ItemQuery.html +82 -1
  55. data/docs/doc/Doing/ItemState.html +1 -1
  56. data/docs/doc/Doing/ItemTags.html +1 -1
  57. data/docs/doc/Doing/Items.html +1 -1
  58. data/docs/doc/Doing/JSONExport.html +1 -1
  59. data/docs/doc/Doing/JSONImport.html +1 -1
  60. data/docs/doc/Doing/Logger.html +1 -1
  61. data/docs/doc/Doing/MarkdownExport.html +1 -1
  62. data/docs/doc/Doing/Note.html +1 -1
  63. data/docs/doc/Doing/Pager.html +1 -1
  64. data/docs/doc/Doing/Plugins.html +1 -1
  65. data/docs/doc/Doing/Prompt.html +1 -1
  66. data/docs/doc/Doing/PromptChoose.html +1 -1
  67. data/docs/doc/Doing/PromptFZF.html +1 -1
  68. data/docs/doc/Doing/PromptInput.html +1 -1
  69. data/docs/doc/Doing/PromptSTD.html +1 -1
  70. data/docs/doc/Doing/PromptYN.html +1 -1
  71. data/docs/doc/Doing/Section.html +1 -1
  72. data/docs/doc/Doing/StringHighlight.html +1 -1
  73. data/docs/doc/Doing/StringNormalize.html +1 -1
  74. data/docs/doc/Doing/StringQuery.html +1 -1
  75. data/docs/doc/Doing/StringTags.html +1 -1
  76. data/docs/doc/Doing/StringTransform.html +1 -1
  77. data/docs/doc/Doing/StringTruncate.html +1 -1
  78. data/docs/doc/Doing/StringURL.html +1 -1
  79. data/docs/doc/Doing/SymbolNormalize.html +1 -1
  80. data/docs/doc/Doing/TaskPaperExport.html +1 -1
  81. data/docs/doc/Doing/TemplateExport.html +1 -1
  82. data/docs/doc/Doing/TemplateString.html +1 -1
  83. data/docs/doc/Doing/TimingImport.html +1 -1
  84. data/docs/doc/Doing/Types.html +1 -1
  85. data/docs/doc/Doing/Util/Backup.html +1 -1
  86. data/docs/doc/Doing/Util.html +1 -1
  87. data/docs/doc/Doing/Version.html +1 -1
  88. data/docs/doc/Doing/WWID.html +35 -1
  89. data/docs/doc/Doing.html +2 -2
  90. data/docs/doc/FalseClass.html +1 -1
  91. data/docs/doc/GLI/Commands/Help.html +1 -1
  92. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  93. data/docs/doc/GLI/Commands.html +1 -1
  94. data/docs/doc/GLI.html +1 -1
  95. data/docs/doc/Hash.html +1 -1
  96. data/docs/doc/Numeric.html +1 -1
  97. data/docs/doc/Object.html +1 -1
  98. data/docs/doc/PhraseParser/Operator.html +1 -1
  99. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  100. data/docs/doc/PhraseParser/Query.html +1 -1
  101. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  102. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  103. data/docs/doc/PhraseParser/TermClause.html +1 -1
  104. data/docs/doc/PhraseParser.html +1 -1
  105. data/docs/doc/Status.html +1 -1
  106. data/docs/doc/String.html +1 -1
  107. data/docs/doc/Symbol.html +1 -1
  108. data/docs/doc/Time.html +1 -1
  109. data/docs/doc/TrueClass.html +1 -1
  110. data/docs/doc/_index.html +1 -1
  111. data/docs/doc/file.README.html +2 -2
  112. data/docs/doc/index.html +2 -2
  113. data/docs/doc/method_list.html +325 -309
  114. data/docs/doc/top-level-namespace.html +1 -1
  115. data/doing.rdoc +3 -3
  116. data/lib/doing/configuration.rb +2 -2
  117. data/lib/doing/item/query.rb +137 -16
  118. data/lib/doing/plugins/export/markdown_export.rb +1 -0
  119. data/lib/doing/plugins/import/calendar_import.rb +0 -0
  120. data/lib/doing/version.rb +1 -1
  121. data/lib/doing/wwid/display.rb +1 -2
  122. data/lib/doing/wwid/filter.rb +14 -133
  123. data/lib/doing/wwid/wwid.rb +0 -0
  124. data/lib/helpers/fzf/test/test_go.rb +0 -0
  125. data/lib/helpers/threaded_tests.rb +0 -0
  126. metadata +2 -2
@@ -216,7 +216,7 @@
216
216
  </div>
217
217
 
218
218
  <div id="footer">
219
- Generated on Wed May 25 12:41:22 2022 by
219
+ Generated on Thu May 26 10:22:39 2022 by
220
220
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
221
221
  0.9.27 (ruby-3.0.1).
222
222
  </div>
data/doing.rdoc CHANGED
@@ -5,7 +5,7 @@ record of what you've been doing, complete with tag-based time tracking. The
5
5
  command line tool allows you to add entries, annotate with tags and notes, and
6
6
  view your entries with myriad options, with a focus on a "natural" language syntax.
7
7
 
8
- v2.1.52
8
+ v2.1.56
9
9
 
10
10
  === Global Options
11
11
  === --config_file arg
@@ -531,14 +531,14 @@ Deprecated, specify shell as argument to subcommand
531
531
  ====== Command: <tt>generate [zsh|bash|fish|all]</tt>
532
532
  Generate completion scripts, including custom plugins and command options
533
533
 
534
- Argument specifies which shell to install for: zsh, bash, fish, all
534
+ Argument specifies which shell to generate for: zsh, bash, fish, all
535
535
  ======= Options
536
536
  ======= -f|--file PATH
537
537
 
538
538
  Alternative file to write output to
539
539
 
540
540
  [Default Value] None
541
- Argument specifies which shell to install for: zsh, bash, fish, all
541
+ Argument specifies which shell to generate for: zsh, bash, fish, all
542
542
 
543
543
  ======= --stdout
544
544
  Output result to STDOUT only
@@ -238,13 +238,13 @@ module Doing
238
238
  raise InvalidArgument, 'Invalid key path' unless res
239
239
 
240
240
  real_path.push(path).concat(paths).compact!
241
- Doing.logger.debug('Config:', "translated key path #{keypath} to #{real_path.join('.')}")
241
+ Doing.logger.debug('Config:', "translated key path #{keypath} to #{real_path.join('.')}") unless keypath == real_path.join('.')
242
242
  return real_path
243
243
  end
244
244
  cfg = new_cfg
245
245
  end
246
246
  end
247
- Doing.logger.debug('Config:', "translated key path #{keypath} to #{real_path.join('.')}")
247
+ Doing.logger.debug('Config:', "translated key path #{keypath} to #{real_path.join('.')}") unless keypath == real_path.join('.')
248
248
  real_path
249
249
  end
250
250
 
@@ -152,6 +152,133 @@ module Doing
152
152
  negate ? !matches : matches
153
153
  end
154
154
 
155
+ ##
156
+ ## Used by filter_items determine whether an item matches a set of criteria
157
+ ##
158
+ ## @param opt [Hash] filter parameters
159
+ ##
160
+ ## @return [Boolean] whether the item matches all filter criteria
161
+ ##
162
+ def keep_item?(opt)
163
+ item = dup
164
+ time_rx = /^(\d{1,2}+(:\d{1,2}+)?( *(am|pm))?|midnight|noon)$/i
165
+
166
+ keep = true
167
+ if opt[:unfinished]
168
+ finished = item.tags?('done', :and)
169
+ finished = opt[:not] ? !finished : finished
170
+ keep = false if finished
171
+ end
172
+
173
+ if keep && opt[:val]&.count&.positive?
174
+ bool = opt[:bool].normalize_bool if opt[:bool]
175
+ bool ||= :and
176
+ bool = :and if bool == :pattern
177
+
178
+ val_match = opt[:val].nil? || opt[:val].empty? ? true : item.tag_values?(opt[:val], bool)
179
+ keep = false unless val_match
180
+ keep = opt[:not] ? !keep : keep
181
+ end
182
+
183
+ if keep && opt[:tag]
184
+ opt[:tag_bool] = opt[:bool].normalize_bool if opt[:bool]
185
+ opt[:tag_bool] ||= :and
186
+ tag_match = opt[:tag].nil? || opt[:tag].empty? ? true : item.tags?(opt[:tag], opt[:tag_bool])
187
+ keep = false unless tag_match
188
+ keep = opt[:not] ? !keep : keep
189
+ end
190
+
191
+ if keep && opt[:search]
192
+ search_match = if opt[:search].nil? || opt[:search].empty?
193
+ true
194
+ else
195
+ item.search(opt[:search], case_type: opt[:case].normalize_case)
196
+ end
197
+
198
+ keep = false unless search_match
199
+ keep = opt[:not] ? !keep : keep
200
+ end
201
+
202
+ if keep && opt[:date_filter]&.length == 2
203
+ start_date = opt[:date_filter][0]
204
+ end_date = opt[:date_filter][1]
205
+
206
+ in_date_range = if end_date
207
+ item.date >= start_date && item.date <= end_date
208
+ else
209
+ item.date.strftime('%F') == start_date.strftime('%F')
210
+ end
211
+ keep = false unless in_date_range
212
+ keep = opt[:not] ? !keep : keep
213
+ end
214
+
215
+ if keep && opt[:time_filter][0] || opt[:time_filter][1]
216
+ opt[:time_filter].map! { |v| v =~ /(12 *am|midnight)/i ? '00:00' : v }
217
+
218
+ start_string = if opt[:time_filter][0].nil?
219
+ "#{item.date.strftime('%Y-%m-%d')} 00:00"
220
+ else
221
+ "#{item.date.strftime('%Y-%m-%d')} #{opt[:time_filter][0]}"
222
+ end
223
+ start_time = start_string.chronify(guess: :begin)
224
+
225
+ end_string = if opt[:time_filter][1].nil?
226
+ "#{item.date.to_datetime.next_day.strftime('%Y-%m-%d')} 00:00"
227
+ else
228
+ "#{item.date.strftime('%Y-%m-%d')} #{opt[:time_filter][1]}"
229
+ end
230
+ end_time = end_string.chronify(guess: :end) || Time.now
231
+
232
+ in_time_range = item.date >= start_time && item.date <= end_time
233
+
234
+ keep = false unless in_time_range
235
+ keep = opt[:not] ? !keep : keep
236
+ end
237
+
238
+ keep = false if keep && opt[:only_timed] && !item.interval
239
+
240
+ if keep && opt[:tag_filter]
241
+ keep = item.tags?(opt[:tag_filter]['tags'], opt[:tag_filter]['bool'])
242
+ keep = opt[:not] ? !keep : keep
243
+ end
244
+
245
+ if keep && opt[:before]
246
+ before = opt[:before]
247
+ cutoff = if before =~ time_rx
248
+ "#{item.date.strftime('%Y-%m-%d')} #{before}".chronify(guess: :begin)
249
+ elsif before.is_a?(String)
250
+ before.chronify(guess: :begin)
251
+ else
252
+ before
253
+ end
254
+ keep = cutoff && item.date <= cutoff
255
+ keep = opt[:not] ? !keep : keep
256
+ end
257
+
258
+ if keep && opt[:after]
259
+ after = opt[:after]
260
+ cutoff = if after =~ time_rx
261
+ "#{item.date.strftime('%Y-%m-%d')} #{after}".chronify(guess: :end)
262
+ elsif after.is_a?(String)
263
+ after.chronify(guess: :end)
264
+ else
265
+ after
266
+ end
267
+ keep = cutoff && item.date >= cutoff
268
+ keep = opt[:not] ? !keep : keep
269
+ end
270
+
271
+ if keep && opt[:today]
272
+ keep = item.date >= Date.today.to_time && item.date < Date.today.next_day.to_time
273
+ keep = opt[:not] ? !keep : keep
274
+ elsif keep && opt[:yesterday]
275
+ keep = item.date >= Date.today.prev_day.to_time && item.date < Date.today.to_time
276
+ keep = opt[:not] ? !keep : keep
277
+ end
278
+
279
+ keep
280
+ end
281
+
155
282
  private
156
283
 
157
284
  def all_searches?(searches, case_type: :smart)
@@ -191,11 +318,9 @@ module Doing
191
318
  return true unless tags.good?
192
319
 
193
320
  tags.each do |tag|
194
- if tag =~ /done/ && !should_finish?
195
- next
196
- else
197
- return false unless @title =~ /@#{tag.wildcard_to_rx}(?= |\(|\Z)/i
198
- end
321
+ next if tag =~ /done/ && !should_finish?
322
+
323
+ return false unless @title =~ /@#{tag.wildcard_to_rx}(?= |\(|\Z)/i
199
324
  end
200
325
  true
201
326
  end
@@ -204,11 +329,9 @@ module Doing
204
329
  return true unless tags.good?
205
330
 
206
331
  tags.each do |tag|
207
- if tag =~ /done/ && !should_finish?
208
- return false
209
- else
210
- return false if @title =~ /@#{tag.wildcard_to_rx}(?= |\(|\Z)/i
211
- end
332
+ return false if tag =~ /done/ && !should_finish?
333
+
334
+ return false if @title =~ /@#{tag.wildcard_to_rx}(?= |\(|\Z)/i
212
335
  end
213
336
  true
214
337
  end
@@ -217,11 +340,9 @@ module Doing
217
340
  return true unless tags.good?
218
341
 
219
342
  tags.each do |tag|
220
- if tag =~ /done/ && !should_finish?
221
- return true
222
- else
223
- return true if @title =~ /@#{tag.wildcard_to_rx}(?= |\(|\Z)/i
224
- end
343
+ return true if tag =~ /done/ && !should_finish?
344
+
345
+ return true if @title =~ /@#{tag.wildcard_to_rx}(?= |\(|\Z)/i
225
346
  end
226
347
  false
227
348
  end
@@ -393,7 +514,7 @@ module Doing
393
514
  return false if val.nil? || tag_val.nil?
394
515
 
395
516
  # Fail unless both values are of the same class (float or date)
396
- return false unless val.class == tag_val.class
517
+ return false unless val.instance_of?(tag_val.class)
397
518
 
398
519
  is_match = value_number_matches?(tag_val, comp, val)
399
520
 
@@ -60,6 +60,7 @@ module Doing
60
60
  all_items << {
61
61
  date: i.date.strftime('%a %-I:%M%p'),
62
62
  shortdate: i.date.relative_date,
63
+ flagged: i.title =~ /(?<= |^)@#{Doing.setting('marker_tag')}/,
63
64
  done: done,
64
65
  note: note,
65
66
  section: i.section,
File without changes
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '2.1.52'
2
+ VERSION = '2.1.56'
3
3
  end
@@ -212,7 +212,7 @@ module Doing
212
212
  ##
213
213
  def recent(count = 10, section = nil, opt)
214
214
  opt ||= {}
215
- times = opt[:t] || true
215
+ opt[:times] ||= false
216
216
  opt[:totals] ||= false
217
217
  opt[:sort_tags] ||= false
218
218
 
@@ -236,7 +236,6 @@ module Doing
236
236
  opt[:format] = cfg['date_format']
237
237
  opt[:template] = opt[:template] || cfg['template']
238
238
  opt[:order] = :asc
239
- opt[:times] = times
240
239
 
241
240
  list_section(opt)
242
241
  end
@@ -13,15 +13,19 @@ module Doing
13
13
  # @return [Items] Filtered Items array
14
14
  #
15
15
  def fuzzy_filter_items(items, query, case_type: :smart)
16
- scannable = items.map.with_index { |item, idx| "#{item.title} #{item.note.join(' ')}".gsub(/[|*?!]/, '') + "|#{idx}" }.join("\n")
16
+ scannable = items.map.with_index { |item, idx| "#{item.title} #{item.note.join(' ')}".gsub(/[|*?!]/, '') + "|#{idx}" }.join("\n")
17
17
 
18
- fzf_args = [
19
- '--multi',
20
- %(--filter="#{query.sub(/^'?/, "'")}"),
21
- '--no-sort',
22
- '-d "\|"',
23
- '--nth=1'
24
- ]
18
+ res = `echo #{Shellwords.escape(scannable)}|#{Prompt.fzf} #{fuzzy_filter_args(query, case_type).join(' ')}`
19
+ selected = Items.new
20
+ res.split(/\n/).each do |item|
21
+ idx = item.match(/\|(\d+)$/)[1].to_i
22
+ selected.push(items[idx])
23
+ end
24
+ selected
25
+ end
26
+
27
+ def fuzzy_filter_args(query, case_type)
28
+ fzf_args = ['--multi', %(--filter="#{query.sub(/^'?/, "'")}"), '--no-sort', '-d "\|"', '--nth=1']
25
29
  fzf_args << case case_type.normalize_case
26
30
  when :smart
27
31
  query =~ /[A-Z]/ ? '+i' : '-i'
@@ -30,16 +34,7 @@ module Doing
30
34
  when :ignore
31
35
  '-i'
32
36
  end
33
-
34
- # fzf_args << '-e' if opt[:exact]
35
- # puts fzf_args.join(' ')
36
- res = `echo #{Shellwords.escape(scannable)}|#{Prompt.fzf} #{fzf_args.join(' ')}`
37
- selected = Items.new
38
- res.split(/\n/).each do |item|
39
- idx = item.match(/\|(\d+)$/)[1].to_i
40
- selected.push(items[idx])
41
- end
42
- selected
37
+ fzf_args
43
38
  end
44
39
 
45
40
  ##
@@ -95,122 +90,8 @@ module Doing
95
90
 
96
91
  items.sort_by! { |item| [item.date, item.title.downcase] }.reverse
97
92
 
98
- filtered_items = items.select do |item|
99
- keep = true
100
- if opt[:unfinished]
101
- finished = item.tags?('done', :and)
102
- finished = opt[:not] ? !finished : finished
103
- keep = false if finished
104
- end
105
-
106
- if keep && opt[:val]&.count&.positive?
107
- bool = opt[:bool].normalize_bool if opt[:bool]
108
- bool ||= :and
109
- bool = :and if bool == :pattern
110
-
111
- val_match = opt[:val].nil? || opt[:val].empty? ? true : item.tag_values?(opt[:val], bool)
112
- keep = false unless val_match
113
- keep = opt[:not] ? !keep : keep
114
- end
115
-
116
- if keep && opt[:tag]
117
- opt[:tag_bool] = opt[:bool].normalize_bool if opt[:bool]
118
- opt[:tag_bool] ||= :and
119
- tag_match = opt[:tag].nil? || opt[:tag].empty? ? true : item.tags?(opt[:tag], opt[:tag_bool])
120
- keep = false unless tag_match
121
- keep = opt[:not] ? !keep : keep
122
- end
123
-
124
- if keep && opt[:search]
125
- search_match = if opt[:search].nil? || opt[:search].empty?
126
- true
127
- else
128
- item.search(opt[:search], case_type: opt[:case].normalize_case)
129
- end
93
+ filtered_items = items.select { |item| item.keep_item?(opt) }
130
94
 
131
- keep = false unless search_match
132
- keep = opt[:not] ? !keep : keep
133
- end
134
-
135
- if keep && opt[:date_filter]&.length == 2
136
- start_date = opt[:date_filter][0]
137
- end_date = opt[:date_filter][1]
138
-
139
- in_date_range = if end_date
140
- item.date >= start_date && item.date <= end_date
141
- else
142
- item.date.strftime('%F') == start_date.strftime('%F')
143
- end
144
- keep = false unless in_date_range
145
- keep = opt[:not] ? !keep : keep
146
- end
147
-
148
- if keep && opt[:time_filter][0] || opt[:time_filter][1]
149
- opt[:time_filter].map! { |v| v =~ /(12 *am|midnight)/i ? '00:00' : v }
150
-
151
- start_string = if opt[:time_filter][0].nil?
152
- "#{item.date.strftime('%Y-%m-%d')} 00:00"
153
- else
154
- "#{item.date.strftime('%Y-%m-%d')} #{opt[:time_filter][0]}"
155
- end
156
- start_time = start_string.chronify(guess: :begin)
157
-
158
- end_string = if opt[:time_filter][1].nil?
159
- "#{item.date.to_datetime.next_day.strftime('%Y-%m-%d')} 00:00"
160
- else
161
- "#{item.date.strftime('%Y-%m-%d')} #{opt[:time_filter][1]}"
162
- end
163
- end_time = end_string.chronify(guess: :end) || Time.now
164
-
165
- in_time_range = item.date >= start_time && item.date <= end_time
166
-
167
- keep = false unless in_time_range
168
- keep = opt[:not] ? !keep : keep
169
- end
170
-
171
- keep = false if keep && opt[:only_timed] && !item.interval
172
-
173
- if keep && opt[:tag_filter]
174
- keep = item.tags?(opt[:tag_filter]['tags'], opt[:tag_filter]['bool'])
175
- keep = opt[:not] ? !keep : keep
176
- end
177
-
178
- if keep && opt[:before]
179
- before = opt[:before]
180
- cutoff = if before =~ time_rx
181
- "#{item.date.strftime('%Y-%m-%d')} #{before}".chronify(guess: :begin)
182
- elsif before.is_a?(String)
183
- before.chronify(guess: :begin)
184
- else
185
- before
186
- end
187
- keep = cutoff && item.date <= cutoff
188
- keep = opt[:not] ? !keep : keep
189
- end
190
-
191
- if keep && opt[:after]
192
- after = opt[:after]
193
- cutoff = if after =~ time_rx
194
- "#{item.date.strftime('%Y-%m-%d')} #{after}".chronify(guess: :end)
195
- elsif after.is_a?(String)
196
- after.chronify(guess: :end)
197
- else
198
- after
199
- end
200
- keep = cutoff && item.date >= cutoff
201
- keep = opt[:not] ? !keep : keep
202
- end
203
-
204
- if keep && opt[:today]
205
- keep = item.date >= Date.today.to_time && item.date < Date.today.next_day.to_time
206
- keep = opt[:not] ? !keep : keep
207
- elsif keep && opt[:yesterday]
208
- keep = item.date >= Date.today.prev_day.to_time && item.date < Date.today.to_time
209
- keep = opt[:not] ? !keep : keep
210
- end
211
-
212
- keep
213
- end
214
95
  count = opt[:count].to_i&.positive? ? opt[:count].to_i : filtered_items.count
215
96
 
216
97
  output = Items.new
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.52
4
+ version: 2.1.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-25 00:00:00.000000000 Z
11
+ date: 2022-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-markup