doing 2.1.80 → 2.1.81

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile.lock +13 -15
  4. data/README.md +1 -1
  5. data/bin/commands/again.rb +1 -1
  6. data/bin/commands/archive.rb +1 -1
  7. data/bin/commands/cancel.rb +1 -1
  8. data/bin/commands/finish.rb +1 -1
  9. data/bin/commands/flag.rb +1 -1
  10. data/bin/commands/grep.rb +3 -2
  11. data/bin/commands/last.rb +1 -1
  12. data/bin/commands/note.rb +1 -1
  13. data/bin/commands/on.rb +1 -1
  14. data/bin/commands/recent.rb +1 -1
  15. data/bin/commands/reset.rb +1 -1
  16. data/bin/commands/select.rb +1 -1
  17. data/bin/commands/show.rb +5 -3
  18. data/bin/commands/since.rb +1 -1
  19. data/bin/commands/tag.rb +9 -16
  20. data/bin/commands/tags.rb +1 -1
  21. data/bin/commands/today.rb +1 -1
  22. data/bin/commands/view.rb +1 -1
  23. data/bin/commands/views.rb +1 -1
  24. data/bin/commands/yesterday.rb +1 -1
  25. data/docs/doc/Array.html +66 -4
  26. data/docs/doc/BooleanTermParser/Clause.html +3 -3
  27. data/docs/doc/BooleanTermParser/Operator.html +3 -3
  28. data/docs/doc/BooleanTermParser/Query.html +3 -3
  29. data/docs/doc/BooleanTermParser/QueryParser.html +3 -3
  30. data/docs/doc/BooleanTermParser/QueryTransformer.html +3 -3
  31. data/docs/doc/BooleanTermParser.html +3 -3
  32. data/docs/doc/Doing/ArrayCleanup.html +3 -3
  33. data/docs/doc/Doing/ArrayNestedHash.html +3 -3
  34. data/docs/doc/Doing/ArrayTags.html +3 -3
  35. data/docs/doc/Doing/ByDayExport.html +3 -3
  36. data/docs/doc/Doing/CSVExport.html +3 -3
  37. data/docs/doc/Doing/CalendarImport.html +3 -3
  38. data/docs/doc/Doing/Change.html +3 -3
  39. data/docs/doc/Doing/Changes.html +3 -3
  40. data/docs/doc/Doing/ChronifyArray.html +3 -3
  41. data/docs/doc/Doing/ChronifyNumeric.html +3 -3
  42. data/docs/doc/Doing/ChronifyString.html +3 -3
  43. data/docs/doc/Doing/Color.html +3 -19
  44. data/docs/doc/Doing/Completion/BashCompletions.html +3 -3
  45. data/docs/doc/Doing/Completion/FigCompletions.html +3 -3
  46. data/docs/doc/Doing/Completion/FishCompletions.html +3 -3
  47. data/docs/doc/Doing/Completion/StringUtils.html +3 -3
  48. data/docs/doc/Doing/Completion/ZshCompletions.html +3 -3
  49. data/docs/doc/Doing/Completion.html +3 -3
  50. data/docs/doc/Doing/Configuration.html +3 -3
  51. data/docs/doc/Doing/DayOneRenderer.html +3 -3
  52. data/docs/doc/Doing/DayoneExport.html +3 -3
  53. data/docs/doc/Doing/DoingExport.html +3 -3
  54. data/docs/doc/Doing/DoingImport.html +3 -3
  55. data/docs/doc/Doing/Entry.html +3 -3
  56. data/docs/doc/Doing/Errors/DoingNoTraceError.html +3 -3
  57. data/docs/doc/Doing/Errors/DoingRuntimeError.html +3 -3
  58. data/docs/doc/Doing/Errors/DoingStandardError.html +3 -3
  59. data/docs/doc/Doing/Errors/EmptyInput.html +3 -3
  60. data/docs/doc/Doing/Errors/HistoryLimitError.html +3 -3
  61. data/docs/doc/Doing/Errors/InvalidPlugin.html +3 -3
  62. data/docs/doc/Doing/Errors/MissingBackupFile.html +3 -3
  63. data/docs/doc/Doing/Errors/NoResults.html +3 -3
  64. data/docs/doc/Doing/Errors/PluginException.html +3 -3
  65. data/docs/doc/Doing/Errors/UserCancelled.html +3 -3
  66. data/docs/doc/Doing/Errors/WrongCommand.html +3 -3
  67. data/docs/doc/Doing/Errors.html +3 -3
  68. data/docs/doc/Doing/HTMLExport.html +3 -3
  69. data/docs/doc/Doing/Hooks.html +3 -3
  70. data/docs/doc/Doing/Item.html +4 -4
  71. data/docs/doc/Doing/ItemDates.html +3 -3
  72. data/docs/doc/Doing/ItemQuery.html +3 -3
  73. data/docs/doc/Doing/ItemState.html +3 -3
  74. data/docs/doc/Doing/ItemTags.html +3 -3
  75. data/docs/doc/Doing/Items.html +4 -4
  76. data/docs/doc/Doing/JSONExport.html +3 -3
  77. data/docs/doc/Doing/JSONImport.html +3 -3
  78. data/docs/doc/Doing/Logger.html +3 -3
  79. data/docs/doc/Doing/MarkdownExport.html +3 -3
  80. data/docs/doc/Doing/Note.html +4 -4
  81. data/docs/doc/Doing/Pager.html +3 -3
  82. data/docs/doc/Doing/Plugins.html +3 -3
  83. data/docs/doc/Doing/Prompt.html +4 -4
  84. data/docs/doc/Doing/PromptChoose.html +3 -3
  85. data/docs/doc/Doing/PromptFZF.html +3 -3
  86. data/docs/doc/Doing/PromptInput.html +3 -3
  87. data/docs/doc/Doing/PromptSTD.html +3 -3
  88. data/docs/doc/Doing/PromptYN.html +3 -3
  89. data/docs/doc/Doing/Section.html +3 -3
  90. data/docs/doc/Doing/StringHighlight.html +3 -3
  91. data/docs/doc/Doing/StringNormalize.html +3 -3
  92. data/docs/doc/Doing/StringQuery.html +3 -3
  93. data/docs/doc/Doing/StringTags.html +3 -3
  94. data/docs/doc/Doing/StringTransform.html +3 -3
  95. data/docs/doc/Doing/StringTruncate.html +3 -3
  96. data/docs/doc/Doing/StringURL.html +3 -3
  97. data/docs/doc/Doing/SymbolNormalize.html +3 -3
  98. data/docs/doc/Doing/TaskPaperExport.html +3 -3
  99. data/docs/doc/Doing/TemplateExport.html +4 -4
  100. data/docs/doc/Doing/TemplateString.html +4 -4
  101. data/docs/doc/Doing/TimingImport.html +3 -3
  102. data/docs/doc/Doing/Types.html +3 -3
  103. data/docs/doc/Doing/Util/Backup.html +3 -3
  104. data/docs/doc/Doing/Util.html +3 -3
  105. data/docs/doc/Doing/Version.html +3 -3
  106. data/docs/doc/Doing/WWID.html +4 -4
  107. data/docs/doc/Doing.html +4 -4
  108. data/docs/doc/FalseClass.html +3 -3
  109. data/docs/doc/GLI/Commands/Help.html +3 -3
  110. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +3 -3
  111. data/docs/doc/GLI/Commands.html +3 -3
  112. data/docs/doc/GLI.html +3 -3
  113. data/docs/doc/Hash.html +3 -3
  114. data/docs/doc/Numeric.html +3 -3
  115. data/docs/doc/Object.html +3 -3
  116. data/docs/doc/PhraseParser/Operator.html +3 -3
  117. data/docs/doc/PhraseParser/PhraseClause.html +3 -3
  118. data/docs/doc/PhraseParser/Query.html +3 -3
  119. data/docs/doc/PhraseParser/QueryParser.html +3 -3
  120. data/docs/doc/PhraseParser/QueryTransformer.html +3 -3
  121. data/docs/doc/PhraseParser/TermClause.html +3 -3
  122. data/docs/doc/PhraseParser.html +3 -3
  123. data/docs/doc/Status.html +3 -3
  124. data/docs/doc/String.html +4 -4
  125. data/docs/doc/Symbol.html +3 -3
  126. data/docs/doc/Time.html +3 -3
  127. data/docs/doc/TrueClass.html +3 -3
  128. data/docs/doc/_index.html +4 -4
  129. data/docs/doc/file.README.html +4 -4
  130. data/docs/doc/frames.html +1 -1
  131. data/docs/doc/index.html +4 -4
  132. data/docs/doc/method_list.html +605 -597
  133. data/docs/doc/top-level-namespace.html +3 -3
  134. data/doing.rdoc +2 -2
  135. data/lib/doing/array/array.rb +9 -0
  136. data/lib/doing/colors.rb +3 -7
  137. data/lib/doing/item/query.rb +3 -3
  138. data/lib/doing/version.rb +1 -1
  139. data/lib/doing/wwid/display.rb +5 -2
  140. data/lib/doing/wwid/filetools.rb +1 -0
  141. data/lib/doing/wwid/filter.rb +9 -2
  142. data/lib/doing/wwid/guess.rb +13 -2
  143. data/lib/doing/wwid/interactive.rb +2 -1
  144. data/lib/doing/wwid/modify.rb +2 -1
  145. data/lib/doing.rb +2 -2
  146. data/lib/examples/commands/autotag.rb +1 -1
  147. data/lib/examples/commands/wiki.rb +1 -1
  148. metadata +3 -3
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Top Level Namespace
8
8
 
9
- &mdash; Documentation by YARD 0.9.28
9
+ &mdash; Documentation by YARD 0.9.34
10
10
 
11
11
  </title>
12
12
 
@@ -216,9 +216,9 @@
216
216
  </div>
217
217
 
218
218
  <div id="footer">
219
- Generated on Sat Mar 11 10:54:30 2023 by
219
+ Generated on Wed May 31 15:49:41 2023 by
220
220
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
221
- 0.9.28 (ruby-3.0.1).
221
+ 0.9.34 (ruby-3.2.0).
222
222
  </div>
223
223
 
224
224
  </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.80
8
+ v2.1.81
9
9
 
10
10
  === Global Options
11
11
  === --config_file arg
@@ -889,7 +889,7 @@ Force exact search string matching (case sensitive)
889
889
  ==== Command: <tt>grep|search SEARCH_PATTERN</tt>
890
890
  Search for entries
891
891
 
892
- Search all sections (or limit to a single section) for entries matching text or regular expression. Normal strings are fuzzy matched.
892
+ Search all sections (or limit to a specific sections) for entries matching text or regular expression. Normal strings are fuzzy matched.
893
893
 
894
894
  To search with regular expressions, single quote the string and surround with slashes: `doing search '/m.*?x/'`
895
895
  ===== Options
@@ -22,5 +22,14 @@ module Doing
22
22
  self
23
23
  end
24
24
  end
25
+
26
+ ##
27
+ ## Capitalize first letter of each element
28
+ ##
29
+ ## @return [Array] capitalized items
30
+ ##
31
+ def cap_first
32
+ map(&:cap_first)
33
+ end
25
34
  end
26
35
  end
data/lib/doing/colors.rb CHANGED
@@ -296,19 +296,15 @@ module Doing
296
296
  "\e[#{is_bg ? '48' : '38'};2;#{t.join(';')}m"
297
297
  end
298
298
 
299
- # Regular expression that is used to scan for ANSI-sequences while
300
- # uncoloring strings.
301
- COLORED_REGEXP = /\e\[(?:(?:[349]|10)[0-7]|[0-9])?m/.freeze
302
-
303
299
  # Returns an uncolored version of the string, that is all
304
300
  # ANSI-sequences are stripped from the string.
305
301
  def uncolor(string = nil) # :yields:
306
302
  if block_given?
307
- yield.to_str.gsub(COLORED_REGEXP, '')
303
+ yield.to_str.gsub(ESCAPE_REGEX, '')
308
304
  elsif string.respond_to?(:to_str)
309
- string.to_str.gsub(COLORED_REGEXP, '')
305
+ string.to_str.gsub(ESCAPE_REGEX, '')
310
306
  elsif respond_to?(:to_str)
311
- to_str.gsub(COLORED_REGEXP, '')
307
+ to_str.gsub(ESCAPE_REGEX, '')
312
308
  else
313
309
  ''
314
310
  end
@@ -244,7 +244,7 @@ module Doing
244
244
 
245
245
  if keep && opt[:before]
246
246
  before = opt[:before]
247
- cutoff = if before =~ time_rx
247
+ cutoff = if before.is_a?(String) && before =~ time_rx
248
248
  "#{item.date.strftime('%Y-%m-%d')} #{before}".chronify(guess: :begin)
249
249
  elsif before.is_a?(String)
250
250
  before.chronify(guess: :begin)
@@ -257,7 +257,7 @@ module Doing
257
257
 
258
258
  if keep && opt[:after]
259
259
  after = opt[:after]
260
- cutoff = if after =~ time_rx
260
+ cutoff = if after.is_a?(String) && after =~ time_rx
261
261
  "#{item.date.strftime('%Y-%m-%d')} #{after}".chronify(guess: :end)
262
262
  elsif after.is_a?(String)
263
263
  after.chronify(guess: :end)
@@ -342,7 +342,7 @@ module Doing
342
342
  tags.each do |tag|
343
343
  return true if tag =~ /done/ && !should_finish?
344
344
 
345
- return true if @title =~ /@#{tag.wildcard_to_rx}(?= |\(|\Z)/i
345
+ return true if @title =~ /@#{Regexp.escape(tag.wildcard_to_rx)}(?= |\(|\Z)/i
346
346
  end
347
347
  false
348
348
  end
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '2.1.80'
2
+ VERSION = '2.1.81'
3
3
  end
@@ -46,7 +46,9 @@ module Doing
46
46
  if opt[:section].nil?
47
47
  opt[:section] = choose_section
48
48
  title = opt[:section]
49
- elsif opt[:section].instance_of?(String)
49
+ elsif opt[:section].is_a?(Array)
50
+ title = opt[:section].join(', ')
51
+ elsif opt[:section].is_a?(String)
50
52
  title = if opt[:section] =~ /^all$/i
51
53
  if opt[:page_title]
52
54
  opt[:page_title]
@@ -254,7 +256,8 @@ module Doing
254
256
  ## @param section [String] Section to pull from, default Currently
255
257
  ##
256
258
  def last(times: true, section: nil, options: {})
257
- section = section.nil? || section =~ /all/i ? 'All' : guess_section(section)
259
+ section = section[0] if section.is_a?(Array) && section.count == 1
260
+ section = section.nil? ? 'All' : guess_section(section)
258
261
  cfg = Doing.setting(['templates', options[:config_template]]).deep_merge(Doing.setting('templates.default'), { extend_existing_arrays: true, sort_merged_arrays: true }).deep_merge({
259
262
  'wrap_width' => Doing.setting('wrap_width', 0),
260
263
  'date_format' => Doing.setting('default_date_format'),
@@ -108,6 +108,7 @@ module Doing
108
108
  tags = []
109
109
  tags.concat(opt[:tag].split(/ *, */).map { |t| t.sub(/^@/, '').strip }) if opt[:tag]
110
110
  bool = opt[:bool] || :and
111
+
111
112
  sect = opt[:section] !~ /^all$/i ? guess_section(opt[:section]) : 'all'
112
113
 
113
114
  section = guess_section(sect)
@@ -63,8 +63,15 @@ module Doing
63
63
  time_rx = /^(\d{1,2}+(:\d{1,2}+)?( *(am|pm))?|midnight|noon)$/i
64
64
 
65
65
  if items.nil? || items.empty?
66
- section = opt[:section] ? guess_section(opt[:section]) : 'All'
67
- items = section =~ /^all$/i ? @content.clone : @content.in_section(section)
66
+ section = !opt[:section] || opt[:section].empty? ? 'All' : guess_section(opt[:section])
67
+ if section.is_a?(Array)
68
+ section.each do |s|
69
+ s = s[0] if s.is_a?(Array)
70
+ items.concat(s =~ /^all$/i ? @content.clone : @content.in_section(s))
71
+ end
72
+ else
73
+ items = section =~ /^all$/i ? @content.clone : @content.in_section(section)
74
+ end
68
75
  end
69
76
 
70
77
  unless opt[:time_filter]
@@ -9,7 +9,15 @@ module Doing
9
9
  ## @param guessed [Boolean] already guessed and failed
10
10
  ##
11
11
  def guess_section(frag, guessed: false, suggest: false)
12
- return 'All' if frag =~ /^all$/i
12
+ if frag.is_a?(Array) && frag.count == 1
13
+ frag = frag[0]
14
+ end
15
+
16
+ frag = frag.split(/ *, */).map(&:strip) if frag.is_a?(String) && frag =~ /,/
17
+
18
+ return frag.map { |s| guess_section(s, guessed: guessed, suggest: suggest) } if frag.is_a?(Array)
19
+
20
+ return 'All' if frag.empty? || frag.nil? || frag =~ /^all$/i
13
21
 
14
22
  frag ||= Doing.setting('current_section')
15
23
 
@@ -19,7 +27,10 @@ module Doing
19
27
 
20
28
  section = found ? found.title : nil
21
29
 
22
- return section if suggest
30
+ if suggest
31
+ Doing.logger.debug('Match:', %(Assuming "#{sect.title}" from "#{frag}"))
32
+ return section
33
+ end
23
34
 
24
35
  unless section || guessed
25
36
  alt = guess_view(frag, guessed: true, suggest: true)
@@ -33,8 +33,9 @@ module Doing
33
33
  menu_options = %i[search query exact multiple show_if_single menu sort case].each_with_object({}) {
34
34
  |k, hsh| hsh[k] = opt[k]
35
35
  }
36
+ include_section = (opt[:section].is_a?(Array) && opt[:section][0] =~ /^all$/i) || (opt[:section].is_a?(String) && opt[:section] =~ /^all$/i)
36
37
 
37
- selection = Prompt.choose_from_items(items, include_section: opt[:section] =~ /^all$/i, **menu_options)
38
+ selection = Prompt.choose_from_items(items, include_section: include_section, **menu_options)
38
39
 
39
40
  raise NoResults, 'no items selected' if selection.nil? || selection.empty?
40
41
 
@@ -421,7 +421,8 @@ module Doing
421
421
  tags = options[:tags] || []
422
422
  bool = options[:bool] || :and
423
423
 
424
- section = choose_section if section.nil? || section =~ /choose/i
424
+ section = section[0] if section.is_a?(Array) && section.count == 1
425
+ section = choose_section if section.nil? || section.empty? || section.is_a?(String) && section =~ /choose/i
425
426
  archive_all = section =~ /^all$/i # && !(tags.nil? || tags.empty?)
426
427
  section = guess_section(section) unless archive_all
427
428
 
data/lib/doing.rb CHANGED
@@ -4,7 +4,6 @@ require 'doing/version'
4
4
  require 'time'
5
5
  require 'date'
6
6
  require 'yaml'
7
- require 'pp'
8
7
  require 'csv'
9
8
  require 'tempfile'
10
9
  require 'zlib'
@@ -14,9 +13,9 @@ require 'readline'
14
13
  require 'haml'
15
14
  require 'json'
16
15
  require 'logger'
17
- require 'safe_yaml/load'
18
16
  require 'fcntl'
19
17
  require 'digest'
18
+ require 'safe_yaml/load'
20
19
 
21
20
  require 'chronic'
22
21
  require 'tty-link'
@@ -59,6 +58,7 @@ require_relative 'doing/chronify/chronify'
59
58
  module Doing
60
59
  class << self
61
60
  attr_accessor :auto_tag
61
+
62
62
  #
63
63
  # Fetch the logger
64
64
  #
@@ -8,7 +8,7 @@ command :autotag do |c|
8
8
  # to tag command.
9
9
  c.desc 'Section'
10
10
  c.arg_name 'SECTION_NAME'
11
- c.flag %i[s section], default_value: 'All'
11
+ c.flag %i[s section], default_value: 'All', multiple: true
12
12
 
13
13
  c.desc 'How many recent entries to autotag (0 for all)'
14
14
  c.arg_name 'COUNT'
@@ -2,7 +2,7 @@ desc 'Output a tag wiki'
2
2
  command :wiki do |c|
3
3
  c.desc 'Section to rotate'
4
4
  c.arg_name 'SECTION_NAME'
5
- c.flag %i[s section], default_value: 'All'
5
+ c.flag %i[s section], default_value: 'All', multiple: true
6
6
 
7
7
  c.desc 'Tag filter, combine multiple tags with a comma, use with --bool'
8
8
  c.arg_name 'TAG'
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.80
4
+ version: 2.1.81
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-11 00:00:00.000000000 Z
11
+ date: 2023-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-markup
@@ -865,7 +865,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
865
865
  - !ruby/object:Gem::Version
866
866
  version: '0'
867
867
  requirements: []
868
- rubygems_version: 3.2.16
868
+ rubygems_version: 3.4.0.dev
869
869
  signing_key:
870
870
  specification_version: 4
871
871
  summary: A command line tool for managing What Was I Doing reminders