doing 2.1.60 → 2.1.63

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) 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/view.rb +1 -1
  6. data/docs/doc/Array.html +1 -1
  7. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  8. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  9. data/docs/doc/BooleanTermParser/Query.html +1 -1
  10. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  11. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  12. data/docs/doc/BooleanTermParser.html +1 -1
  13. data/docs/doc/Doing/ArrayCleanup.html +1 -1
  14. data/docs/doc/Doing/ArrayNestedHash.html +1 -1
  15. data/docs/doc/Doing/ArrayTags.html +1 -1
  16. data/docs/doc/Doing/CSVExport.html +1 -1
  17. data/docs/doc/Doing/CalendarImport.html +1 -1
  18. data/docs/doc/Doing/Change.html +1 -1
  19. data/docs/doc/Doing/Changes.html +1 -1
  20. data/docs/doc/Doing/ChronifyArray.html +1 -1
  21. data/docs/doc/Doing/ChronifyNumeric.html +1 -1
  22. data/docs/doc/Doing/ChronifyString.html +1 -1
  23. data/docs/doc/Doing/Color.html +6 -1
  24. data/docs/doc/Doing/Completion/BashCompletions.html +1 -1
  25. data/docs/doc/Doing/Completion/FigCompletions.html +1 -1
  26. data/docs/doc/Doing/Completion/FishCompletions.html +1 -1
  27. data/docs/doc/Doing/Completion/StringUtils.html +1 -1
  28. data/docs/doc/Doing/Completion/ZshCompletions.html +1 -1
  29. data/docs/doc/Doing/Completion.html +1 -1
  30. data/docs/doc/Doing/Configuration.html +1 -1
  31. data/docs/doc/Doing/DayOneRenderer.html +1 -1
  32. data/docs/doc/Doing/DayoneExport.html +1 -1
  33. data/docs/doc/Doing/DoingExport.html +1 -1
  34. data/docs/doc/Doing/DoingImport.html +1 -1
  35. data/docs/doc/Doing/Entry.html +1 -1
  36. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  37. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  38. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  39. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  40. data/docs/doc/Doing/Errors/HistoryLimitError.html +1 -1
  41. data/docs/doc/Doing/Errors/InvalidPlugin.html +1 -1
  42. data/docs/doc/Doing/Errors/MissingBackupFile.html +1 -1
  43. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  44. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  45. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  46. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  47. data/docs/doc/Doing/Errors.html +1 -1
  48. data/docs/doc/Doing/HTMLExport.html +1 -1
  49. data/docs/doc/Doing/Hooks.html +1 -1
  50. data/docs/doc/Doing/Item.html +2 -2
  51. data/docs/doc/Doing/ItemDates.html +1 -1
  52. data/docs/doc/Doing/ItemQuery.html +1 -1
  53. data/docs/doc/Doing/ItemState.html +1 -1
  54. data/docs/doc/Doing/ItemTags.html +1 -1
  55. data/docs/doc/Doing/Items.html +1 -1
  56. data/docs/doc/Doing/JSONExport.html +1 -1
  57. data/docs/doc/Doing/JSONImport.html +1 -1
  58. data/docs/doc/Doing/Logger.html +1 -1
  59. data/docs/doc/Doing/MarkdownExport.html +1 -1
  60. data/docs/doc/Doing/Note.html +1 -1
  61. data/docs/doc/Doing/Pager.html +1 -1
  62. data/docs/doc/Doing/Plugins.html +1 -1
  63. data/docs/doc/Doing/Prompt.html +2 -2
  64. data/docs/doc/Doing/PromptChoose.html +1 -1
  65. data/docs/doc/Doing/PromptFZF.html +1 -1
  66. data/docs/doc/Doing/PromptInput.html +1 -1
  67. data/docs/doc/Doing/PromptSTD.html +1 -1
  68. data/docs/doc/Doing/PromptYN.html +1 -1
  69. data/docs/doc/Doing/Section.html +1 -1
  70. data/docs/doc/Doing/StringHighlight.html +1 -1
  71. data/docs/doc/Doing/StringNormalize.html +1 -1
  72. data/docs/doc/Doing/StringQuery.html +1 -1
  73. data/docs/doc/Doing/StringTags.html +1 -1
  74. data/docs/doc/Doing/StringTransform.html +1 -1
  75. data/docs/doc/Doing/StringTruncate.html +1 -1
  76. data/docs/doc/Doing/StringURL.html +1 -1
  77. data/docs/doc/Doing/SymbolNormalize.html +1 -1
  78. data/docs/doc/Doing/TaskPaperExport.html +1 -1
  79. data/docs/doc/Doing/TemplateExport.html +2 -2
  80. data/docs/doc/Doing/TemplateString.html +3 -3
  81. data/docs/doc/Doing/TimingImport.html +1 -1
  82. data/docs/doc/Doing/Types.html +1 -1
  83. data/docs/doc/Doing/Util/Backup.html +1 -1
  84. data/docs/doc/Doing/Util.html +1 -1
  85. data/docs/doc/Doing/Version.html +1 -1
  86. data/docs/doc/Doing/WWID.html +2 -2
  87. data/docs/doc/Doing.html +2 -2
  88. data/docs/doc/FalseClass.html +1 -1
  89. data/docs/doc/GLI/Commands/Help.html +1 -1
  90. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  91. data/docs/doc/GLI/Commands.html +1 -1
  92. data/docs/doc/GLI.html +1 -1
  93. data/docs/doc/Hash.html +1 -1
  94. data/docs/doc/Numeric.html +1 -1
  95. data/docs/doc/Object.html +1 -1
  96. data/docs/doc/PhraseParser/Operator.html +1 -1
  97. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  98. data/docs/doc/PhraseParser/Query.html +1 -1
  99. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  100. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  101. data/docs/doc/PhraseParser/TermClause.html +1 -1
  102. data/docs/doc/PhraseParser.html +1 -1
  103. data/docs/doc/Status.html +1 -1
  104. data/docs/doc/String.html +65 -2
  105. data/docs/doc/Symbol.html +1 -1
  106. data/docs/doc/Time.html +1 -1
  107. data/docs/doc/TrueClass.html +1 -1
  108. data/docs/doc/_index.html +1 -1
  109. data/docs/doc/file.README.html +2 -2
  110. data/docs/doc/index.html +2 -2
  111. data/docs/doc/method_list.html +554 -546
  112. data/docs/doc/top-level-namespace.html +1 -1
  113. data/doing.gemspec +1 -0
  114. data/doing.rdoc +3 -3
  115. data/lib/doing/colors.rb +57 -0
  116. data/lib/doing/item/state.rb +3 -1
  117. data/lib/doing/plugin_manager.rb +11 -0
  118. data/lib/doing/string/highlight.rb +6 -7
  119. data/lib/doing/version.rb +1 -1
  120. data/lib/doing/wwid/timers.rb +1 -156
  121. data/lib/templates/doing.css +2 -2
  122. metadata +2 -2
@@ -216,7 +216,7 @@
216
216
  </div>
217
217
 
218
218
  <div id="footer">
219
- Generated on Wed Jun 29 02:09:35 2022 by
219
+ Generated on Thu Jul 21 07:15:19 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.gemspec CHANGED
@@ -44,5 +44,6 @@ spec = Gem::Specification.new do |s|
44
44
  s.add_runtime_dependency('tty-reader', '~> 0.9', '>= 0.9.0')
45
45
  s.add_runtime_dependency('tty-screen', '~> 0.8', '>= 0.8.1')
46
46
  s.add_runtime_dependency('tty-which', '~> 0.5', '>= 0.5.0')
47
+
47
48
  # s.add_runtime_dependency('amatch', '~> 0.4', '>= 0.4.0')
48
49
  end
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.60
8
+ v2.1.63
9
9
 
10
10
  === Global Options
11
11
  === --config_file arg
@@ -1055,7 +1055,7 @@ List commands one per line, to assist with shell completion
1055
1055
  ==== Command: <tt>import PATH</tt>
1056
1056
  Import entries from an external source
1057
1057
 
1058
- Imports entries from other sources. Available plugins: calendar, capturething, doing, json, timing
1058
+ Imports entries from other sources. Available plugins: calendar, doing, json, timing
1059
1059
  ===== Options
1060
1060
  ===== --after DATE_STRING
1061
1061
 
@@ -1123,7 +1123,7 @@ Tag all imported entries
1123
1123
 
1124
1124
  ===== --type TYPE
1125
1125
 
1126
- Import type (calendar|capturething|doing|json|timing)
1126
+ Import type (calendar|doing|json|timing)
1127
1127
 
1128
1128
  [Default Value] doing
1129
1129
 
data/lib/doing/colors.rb CHANGED
@@ -4,6 +4,7 @@
4
4
  module Doing
5
5
  # Terminal output color functions.
6
6
  module Color
7
+ ESCAPE_REGEX = /(?<=\[)(?:(?:(?:[349]|10)[0-9]|[0-9])?;?)+(?=m)/.freeze
7
8
  # All available color names. Available as methods and string extensions.
8
9
  #
9
10
  # @example Use a color as a method. Color reset will be added to end of string.
@@ -125,6 +126,62 @@ module Doing
125
126
  def normalize_color
126
127
  gsub(/_/, '').sub(/bright/i, 'bold').sub(/bgbold/, 'boldbg')
127
128
  end
129
+
130
+ # Get the calculated ANSI color at the end of the
131
+ # string
132
+ #
133
+ # @return ANSI escape sequence to match color
134
+ #
135
+ def last_color_code
136
+ m = scan(ESCAPE_REGEX)
137
+
138
+ em = ['0']
139
+ fg = nil
140
+ bg = nil
141
+ rgbf = nil
142
+ rgbb = nil
143
+
144
+ m.each do |c|
145
+ case c
146
+ when '0'
147
+ em = ['0']
148
+ fg, bg, rgbf, rgbb = nil
149
+ when /^[34]8/
150
+ case c
151
+ when /^3/
152
+ fg = nil
153
+ rgbf = c
154
+ when /^4/
155
+ bg = nil
156
+ rgbb = c
157
+ end
158
+ else
159
+ c.split(/;/).each do |i|
160
+ x = i.to_i
161
+ if x <= 9
162
+ em << x
163
+ elsif x >= 30 && x <= 39
164
+ rgbf = nil
165
+ fg = x
166
+ elsif x >= 40 && x <= 49
167
+ rgbb = nil
168
+ bg = x
169
+ elsif x >= 90 && x <= 97
170
+ rgbf = nil
171
+ fg = x
172
+ elsif x >= 100 && x <= 107
173
+ rgbb = nil
174
+ bg = x
175
+ end
176
+ end
177
+ end
178
+ end
179
+
180
+ escape = "\e[#{em.join(';')}m"
181
+ escape += "\e[#{rgbb}m" if rgbb
182
+ escape += "\e[#{rgbf}m" if rgbf
183
+ escape + "\e[#{[fg, bg].delete_if(&:nil?).join(';')}m"
184
+ end
128
185
  end
129
186
 
130
187
  class << self
@@ -46,9 +46,11 @@ module Doing
46
46
  return true unless config[key].is_a?(Array)
47
47
 
48
48
  config[key].each do |tag|
49
+ next if tag.nil?
50
+
49
51
  if tag =~ /^@/
50
52
  return false if tags?(tag.sub(/^@/, '').downcase)
51
- elsif section.downcase == tag.downcase
53
+ elsif section&.downcase == tag.downcase
52
54
  return false
53
55
  end
54
56
  end
@@ -32,6 +32,17 @@ module Doing
32
32
  end
33
33
  end
34
34
 
35
+ Gem.find_latest_files('doing-plugin-*', true).sort.each do |plugin|
36
+ load plugin
37
+ end
38
+
39
+ # Gem.path.each do |path|
40
+ # $LOAD_PATH.unshift path
41
+ # Dir.glob(File.join(path, 'gems', 'doing-plugin-*', 'lib', '*.rb')).sort.each do |plugin|
42
+ # require plugin.sub(%r{#{path}/gems/(.*?)-[\d.]+$}, '\1')
43
+ # end
44
+ # end
45
+
35
46
  plugins
36
47
  end
37
48
 
@@ -17,14 +17,9 @@ module Doing
17
17
  ##
18
18
  def highlight_tags(color = 'yellow', last_color: nil)
19
19
  unless last_color
20
- escapes = scan(/(\e\[[\d;]+m)[^\e]+@/)
21
20
  color = color.split(' ') unless color.is_a?(Array)
22
21
  tag_color = color.each_with_object([]) { |c, arr| arr << Doing::Color.send(c) }.join('')
23
- last_color = if escapes.good?
24
- (escapes.count > 1 ? escapes[-2..-1] : [escapes[-1]]).map { |v| v[0] }.join('')
25
- else
26
- Doing::Color.default
27
- end
22
+ last_color = last_color_code
28
23
  end
29
24
  gsub(/(\s|m)(@[^ ("']+)/, "\\1#{tag_color}\\2#{last_color}")
30
25
  end
@@ -54,7 +49,11 @@ module Doing
54
49
  qs.concat(query[:should]) if query[:should]
55
50
  qs.each do |s|
56
51
  rx = Regexp.new(s.wildcard_to_rx, ignore_case(s, case_type))
57
- out.gsub!(rx) { |m| m.bgyellow.black }
52
+ out.gsub!(rx) do
53
+ m = Regexp.last_match
54
+ last = m.pre_match.last_color_code
55
+ "#{m[0].bgyellow.black}#{last}"
56
+ end
58
57
  end
59
58
  end
60
59
  out
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '2.1.60'
2
+ VERSION = '2.1.63'
3
3
  end
@@ -14,162 +14,7 @@ module Doing
14
14
  def tag_times(format: :text, sort_by: :time, sort_order: :asc)
15
15
  return '' if @timers.empty?
16
16
 
17
- max = @timers.keys.sort_by(&:length).reverse[0].length + 1
18
-
19
- total = @timers.delete('All')
20
-
21
- tags_data = @timers.delete_if { |_k, v| v.zero? }
22
- sorted_tags_data = if sort_by.normalize_tag_sort == :name
23
- tags_data.sort_by { |k, _v| k }
24
- else
25
- tags_data.sort_by { |_k, v| v }
26
- end
27
-
28
- sorted_tags_data.reverse! if sort_order.normalize_order == :asc
29
- case format
30
- when :html
31
-
32
- output = <<EOHEAD
33
- <table>
34
- <caption id="tagtotals">Tag Totals</caption>
35
- <colgroup>
36
- <col style="text-align:left;"/>
37
- <col style="text-align:left;"/>
38
- </colgroup>
39
- <thead>
40
- <tr>
41
- <th style="text-align:left;">project</th>
42
- <th style="text-align:left;">time</th>
43
- </tr>
44
- </thead>
45
- <tbody>
46
- EOHEAD
47
- sorted_tags_data.reverse.each do |k, v|
48
- if v.positive?
49
- output += "<tr><td style='text-align:left;'>#{k}</td><td style='text-align:left;'>#{v.time_string(format: :clock)}</td></tr>\n"
50
- end
51
- end
52
- tail = <<EOTAIL
53
- <tr>
54
- <td style="text-align:left;" colspan="2"></td>
55
- </tr>
56
- </tbody>
57
- <tfoot>
58
- <tr>
59
- <td style="text-align:left;"><strong>Total</strong></td>
60
- <td style="text-align:left;">#{total.time_string(format: :clock)}</td>
61
- </tr>
62
- </tfoot>
63
- </table>
64
- EOTAIL
65
- output + tail
66
- when :markdown
67
- pad = sorted_tags_data.map { |k, _| k }.group_by(&:size).max.last[0].length
68
- pad = 7 if pad < 7
69
- output = <<~EOHEADER
70
- | #{' ' * (pad - 7)}project | time |
71
- | #{'-' * (pad - 1)}: | :------- |
72
- EOHEADER
73
- sorted_tags_data.reverse.each do |k, v|
74
- if v.positive?
75
- output += "| #{' ' * (pad - k.length)}#{k} | #{v.time_string(format: :clock)} |\n"
76
- end
77
- end
78
- tail = '[Tag Totals]'
79
- output + tail
80
- when :json
81
- output = []
82
- sorted_tags_data.reverse.each do |k, v|
83
- output << {
84
- 'tag' => k,
85
- 'seconds' => v,
86
- 'formatted' => v.time_string(format: :clock)
87
- }
88
- end
89
- output
90
- when :human
91
- output = []
92
- sorted_tags_data.reverse.each do |k, v|
93
- spacer = ''
94
- (max - k.length).times do
95
- spacer += ' '
96
- end
97
- output.push("┃ #{spacer}#{k}:#{v.time_string(format: :hm)} ┃")
98
- end
99
-
100
- header = '┏━━ Tag Totals '
101
- (max - 2).times { header += '━' }
102
- header += '┓'
103
- footer = '┗'
104
- (max + 12).times { footer += '━' }
105
- footer += '┛'
106
- divider = '┣'
107
- (max + 12).times { divider += '━' }
108
- divider += '┫'
109
- output = output.empty? ? '' : "\n#{header}\n#{output.join("\n")}"
110
- output += "\n#{divider}"
111
- spacer = ''
112
- (max - 6).times do
113
- spacer += ' '
114
- end
115
- total_time = total.time_string(format: :hm)
116
- total = "┃ #{spacer}total: "
117
- total += total_time
118
- total += ' ┃'
119
- output += "\n#{total}"
120
- output += "\n#{footer}"
121
- output
122
- else
123
- output = []
124
- sorted_tags_data.reverse.each do |k, v|
125
- spacer = ''
126
- (max - k.length).times do
127
- spacer += ' '
128
- end
129
- output.push("#{k}:#{spacer}#{v.time_string(format: :clock)}")
130
- end
131
-
132
- output = output.empty? ? '' : "\n--- Tag Totals ---\n#{output.join("\n")}"
133
- output += "\n\nTotal tracked: #{total.time_string(format: :clock)}\n"
134
- output
135
- end
136
- end
137
-
138
- ##
139
- ## Gets the interval between entry's start
140
- ## date and @done date
141
- ##
142
- ## @param item [Item] The entry
143
- ## @param formatted [Boolean] Return human readable
144
- ## time (default seconds)
145
- ## @param record [Boolean] Add the interval to the
146
- ## total for each tag
147
- ##
148
- ## @return Interval in seconds, or [d, h, m] array if
149
- ## formatted is true. False if no end date or
150
- ## interval is 0
151
- ##
152
- def get_interval(item, formatted: true, record: true)
153
- if item.interval
154
- seconds = item.interval
155
- record_tag_times(item, seconds) if record
156
- return seconds.positive? ? seconds : false unless formatted
157
-
158
- return seconds.positive? ? seconds.time_string(format: :clock) : false
159
- end
160
-
161
- false
162
- end##
163
- ## Get total elapsed time for all tags in
164
- ## selection
165
- ##
166
- ## @param format [String] return format (html,
167
- ## json, or text)
168
- ## @param sort_by [Symbol] Sort by :name or :time
169
- ## @param sort_order [Symbol] The sort order (:asc or :desc)
170
- ##
171
- def tag_times(format: :text, sort_by: :time, sort_order: :asc)
172
- return '' if @timers.empty?
17
+ @timers.delete('meanwhile')
173
18
 
174
19
  max = @timers.keys.sort_by(&:length).reverse[0].length + 1
175
20
 
@@ -50,7 +50,7 @@ article > ul > li:hover {
50
50
  .date {
51
51
  color: #7d9ca2;
52
52
  font-size: 17px;
53
- padding: 15px 1ch 0 0;
53
+ padding: 3px 1ch 0 0;
54
54
  text-align: right;
55
55
  white-space: nowrap;
56
56
  transition: color .2s ease-in-out;
@@ -59,7 +59,7 @@ article > ul > li:hover {
59
59
  .entry {
60
60
  border-left: solid 1px #ccc;
61
61
  line-height: 1.2;
62
- padding: 10px 10px 10px 3ch;
62
+ padding: 2px 10px 2px 3ch;
63
63
  text-indent: -2ch;
64
64
  }
65
65
 
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.60
4
+ version: 2.1.63
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-06-29 00:00:00.000000000 Z
11
+ date: 2022-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-markup