doing 2.1.40 → 2.1.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/CHANGELOG.md +22 -0
  4. data/Gemfile.lock +1 -1
  5. data/Rakefile +4 -4
  6. data/bin/commands/changes.rb +1 -1
  7. data/bin/commands/tag_dir.rb +49 -15
  8. data/{Dockerfile → docker/Dockerfile} +3 -1
  9. data/{Dockerfile-2.6 → docker/Dockerfile-2.6} +2 -2
  10. data/{Dockerfile-2.7 → docker/Dockerfile-2.7} +2 -2
  11. data/{Dockerfile-3.0 → docker/Dockerfile-3.0} +2 -2
  12. data/{bash_profile → docker/bash_profile} +0 -0
  13. data/{inputrc → docker/inputrc} +0 -0
  14. data/docs/doc/Array.html +84 -2
  15. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  16. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  17. data/docs/doc/BooleanTermParser/Query.html +1 -1
  18. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  19. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  20. data/docs/doc/BooleanTermParser.html +1 -1
  21. data/docs/doc/Doing/ArrayNestedHash.html +198 -0
  22. data/docs/doc/Doing/ArrayTags.html +424 -0
  23. data/docs/doc/Doing/CSVExport.html +266 -0
  24. data/docs/doc/Doing/CalendarImport.html +232 -0
  25. data/docs/doc/Doing/Change.html +617 -0
  26. data/docs/doc/Doing/Changes.html +468 -0
  27. data/docs/doc/Doing/ChronifyArray.html +347 -0
  28. data/docs/doc/Doing/ChronifyNumeric.html +271 -0
  29. data/docs/doc/Doing/ChronifyString.html +682 -0
  30. data/docs/doc/Doing/Color.html +2 -2
  31. data/docs/doc/Doing/Completion/BashCompletions.html +445 -0
  32. data/docs/doc/Doing/Completion/FishCompletions.html +445 -0
  33. data/docs/doc/Doing/Completion/StringUtils.html +229 -0
  34. data/docs/doc/Doing/Completion/ZshCompletions.html +445 -0
  35. data/docs/doc/Doing/Completion.html +17 -3
  36. data/docs/doc/Doing/Configuration.html +1 -1
  37. data/docs/doc/Doing/DayOneRenderer.html +383 -0
  38. data/docs/doc/Doing/DayoneExport.html +290 -0
  39. data/docs/doc/Doing/DoingImport.html +391 -0
  40. data/docs/doc/Doing/Entry.html +381 -0
  41. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  42. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  43. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  44. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  45. data/docs/doc/Doing/Errors/HistoryLimitError.html +1 -1
  46. data/docs/doc/Doing/Errors/InvalidPlugin.html +1 -1
  47. data/docs/doc/Doing/Errors/MissingBackupFile.html +1 -1
  48. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  49. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  50. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  51. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  52. data/docs/doc/Doing/Errors.html +1 -1
  53. data/docs/doc/Doing/HTMLExport.html +256 -0
  54. data/docs/doc/Doing/Hooks.html +1 -1
  55. data/docs/doc/Doing/Item.html +47 -3
  56. data/docs/doc/Doing/ItemDates.html +564 -0
  57. data/docs/doc/Doing/ItemQuery.html +614 -0
  58. data/docs/doc/Doing/ItemState.html +387 -0
  59. data/docs/doc/Doing/ItemTags.html +498 -0
  60. data/docs/doc/Doing/Items.html +460 -11
  61. data/docs/doc/Doing/JSONExport.html +222 -0
  62. data/docs/doc/Doing/Logger.html +1 -1
  63. data/docs/doc/Doing/MarkdownExport.html +266 -0
  64. data/docs/doc/Doing/MarkdownRenderer.html +383 -0
  65. data/docs/doc/Doing/Note.html +16 -3
  66. data/docs/doc/Doing/Pager.html +1 -1
  67. data/docs/doc/Doing/Plugins.html +1 -1
  68. data/docs/doc/Doing/Prompt.html +31 -682
  69. data/docs/doc/Doing/PromptChoose.html +484 -0
  70. data/docs/doc/Doing/PromptFZF.html +391 -0
  71. data/docs/doc/Doing/PromptInput.html +572 -0
  72. data/docs/doc/Doing/PromptSTD.html +293 -0
  73. data/docs/doc/Doing/PromptYN.html +237 -0
  74. data/docs/doc/Doing/Section.html +58 -2
  75. data/docs/doc/Doing/StringHighlight.html +533 -0
  76. data/docs/doc/Doing/StringNormalize.html +929 -0
  77. data/docs/doc/Doing/StringQuery.html +725 -0
  78. data/docs/doc/Doing/StringTags.html +884 -0
  79. data/docs/doc/Doing/StringTransform.html +565 -0
  80. data/docs/doc/Doing/StringTruncate.html +448 -0
  81. data/docs/doc/Doing/StringURL.html +409 -0
  82. data/docs/doc/Doing/SymbolNormalize.html +341 -0
  83. data/docs/doc/Doing/TaskPaperExport.html +222 -0
  84. data/docs/doc/Doing/TemplateExport.html +249 -0
  85. data/docs/doc/Doing/TemplateString.html +101 -2
  86. data/docs/doc/Doing/TimingImport.html +285 -0
  87. data/docs/doc/Doing/Types.html +1 -1
  88. data/docs/doc/Doing/Util/Backup.html +9 -7
  89. data/docs/doc/Doing/Util.html +2 -2
  90. data/docs/doc/Doing/Version.html +523 -0
  91. data/docs/doc/Doing/WWID/WWIDUtil.html +510 -0
  92. data/docs/doc/Doing/WWID.html +4377 -217
  93. data/docs/doc/Doing/WWIDDisplay.html +865 -0
  94. data/docs/doc/Doing/WWIDEditor.html +466 -0
  95. data/docs/doc/Doing/WWIDFileTools.html +359 -0
  96. data/docs/doc/Doing/WWIDFilter.html +466 -0
  97. data/docs/doc/Doing/WWIDGuess.html +299 -0
  98. data/docs/doc/Doing/WWIDInteractive.html +752 -0
  99. data/docs/doc/Doing/WWIDModify.html +1078 -0
  100. data/docs/doc/Doing/WWIDTags.html +302 -0
  101. data/docs/doc/Doing/WWIDTimers.html +359 -0
  102. data/docs/doc/Doing/WWIDUtil.html +510 -0
  103. data/docs/doc/Doing.html +9 -6
  104. data/docs/doc/FalseClass.html +1 -1
  105. data/docs/doc/GLI/Commands/Help.html +1 -1
  106. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  107. data/docs/doc/GLI/Commands.html +1 -1
  108. data/docs/doc/GLI.html +1 -1
  109. data/docs/doc/Hash.html +1 -1
  110. data/docs/doc/Numeric.html +23 -78
  111. data/docs/doc/Object.html +1 -1
  112. data/docs/doc/PhraseParser/Operator.html +1 -1
  113. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  114. data/docs/doc/PhraseParser/Query.html +1 -1
  115. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  116. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  117. data/docs/doc/PhraseParser/TermClause.html +1 -1
  118. data/docs/doc/PhraseParser.html +1 -1
  119. data/docs/doc/Status.html +1 -1
  120. data/docs/doc/String.html +58 -633
  121. data/docs/doc/Symbol.html +9 -224
  122. data/docs/doc/Time.html +119 -13
  123. data/docs/doc/TrueClass.html +1 -1
  124. data/docs/doc/_index.html +324 -8
  125. data/docs/doc/class_list.html +1 -1
  126. data/docs/doc/file.README.html +1 -1
  127. data/docs/doc/index.html +1 -1
  128. data/docs/doc/method_list.html +2326 -542
  129. data/docs/doc/top-level-namespace.html +2 -2
  130. data/doing.rdoc +13 -3
  131. data/lib/completion/_doing.zsh +1 -1
  132. data/lib/completion/doing.bash +2 -2
  133. data/lib/completion/doing.fish +3 -1
  134. data/lib/doing/array/array.rb +16 -12
  135. data/lib/doing/array/nested_hash.rb +1 -1
  136. data/lib/doing/array/tags.rb +6 -5
  137. data/lib/doing/changelog/changelog.rb +6 -0
  138. data/lib/doing/chronify/array.rb +1 -3
  139. data/lib/doing/chronify/chronify.rb +12 -0
  140. data/lib/doing/chronify/numeric.rb +3 -2
  141. data/lib/doing/chronify/string.rb +1 -1
  142. data/lib/doing/completion/completion_string.rb +25 -0
  143. data/lib/doing/completion.rb +1 -1
  144. data/lib/doing/good.rb +8 -0
  145. data/lib/doing/item/dates.rb +1 -1
  146. data/lib/doing/{item.rb → item/item.rb} +10 -5
  147. data/lib/doing/item/query.rb +1 -1
  148. data/lib/doing/item/state.rb +1 -1
  149. data/lib/doing/item/tags.rb +1 -1
  150. data/lib/doing/items/filter.rb +67 -0
  151. data/lib/doing/items/items.rb +57 -0
  152. data/lib/doing/items/modify.rb +36 -0
  153. data/lib/doing/items/sections.rb +83 -0
  154. data/lib/doing/items/util.rb +74 -0
  155. data/lib/doing/normalize.rb +10 -2
  156. data/lib/doing/plugins/export/markdown_export.rb +4 -2
  157. data/lib/doing/plugins/import/doing_import.rb +1 -1
  158. data/lib/doing/prompt/choose.rb +118 -0
  159. data/lib/doing/prompt/fzf.rb +84 -0
  160. data/lib/doing/prompt/input.rb +129 -0
  161. data/lib/doing/prompt/prompt.rb +41 -0
  162. data/lib/doing/prompt/std.rb +32 -0
  163. data/lib/doing/prompt/yn.rb +64 -0
  164. data/lib/doing/section.rb +4 -0
  165. data/lib/doing/string/highlight.rb +1 -1
  166. data/lib/doing/string/query.rb +1 -1
  167. data/lib/doing/string/string.rb +18 -7
  168. data/lib/doing/string/tags.rb +14 -3
  169. data/lib/doing/string/transform.rb +1 -1
  170. data/lib/doing/string/truncate.rb +1 -1
  171. data/lib/doing/string/url.rb +1 -1
  172. data/lib/doing/time.rb +19 -1
  173. data/lib/doing/util_backup.rb +2 -2
  174. data/lib/doing/version.rb +1 -1
  175. data/lib/doing/wwid/display.rb +357 -360
  176. data/lib/doing/wwid/editor.rb +173 -176
  177. data/lib/doing/wwid/filetools.rb +156 -159
  178. data/lib/doing/wwid/filter.rb +191 -183
  179. data/lib/doing/wwid/guess.rb +58 -60
  180. data/lib/doing/wwid/interactive.rb +332 -330
  181. data/lib/doing/wwid/modify.rb +509 -512
  182. data/lib/doing/wwid/tags.rb +38 -41
  183. data/lib/doing/wwid/timers.rb +293 -296
  184. data/lib/doing/{wwid.rb → wwid/wwid.rb} +32 -23
  185. data/lib/doing/wwid/wwidutil.rb +79 -82
  186. data/lib/doing.rb +5 -5
  187. data/lib/helpers/threaded_tests.rb +1 -0
  188. metadata +76 -14
  189. data/lib/doing/changelog.rb +0 -6
  190. data/lib/doing/completion/string.rb +0 -17
  191. data/lib/doing/items.rb +0 -221
  192. data/lib/doing/prompt.rb +0 -330
@@ -2,212 +2,209 @@
2
2
 
3
3
  module Doing
4
4
  class WWID
5
- # Editor methods for WWID class
6
- module Editor
7
- ##
8
- ## Create a process for an editor and wait for the file handle to return
9
- ##
10
- ## @param input [String] Text input for editor
11
- ##
12
- def fork_editor(input = '', message: :default)
13
- # raise NonInteractive, 'Non-interactive terminal' unless $stdout.isatty || ENV['DOING_EDITOR_TEST']
14
-
15
- raise MissingEditor, 'No EDITOR variable defined in environment' if Util.default_editor.nil?
16
-
17
- tmpfile = Tempfile.new(['doing', '.md'])
18
-
19
- File.open(tmpfile.path, 'w+') do |f|
20
- f.puts input
21
- unless message.nil?
22
- f.puts message == :default ? "# The first line is the entry title, any lines after that are added as a note" : message
23
- end
5
+ ##
6
+ ## Create a process for an editor and wait for the file handle to return
7
+ ##
8
+ ## @param input [String] Text input for editor
9
+ ##
10
+ def fork_editor(input = '', message: :default)
11
+ # raise NonInteractive, 'Non-interactive terminal' unless $stdout.isatty || ENV['DOING_EDITOR_TEST']
12
+
13
+ raise MissingEditor, 'No EDITOR variable defined in environment' if Util.default_editor.nil?
14
+
15
+ tmpfile = Tempfile.new(['doing', '.txt'])
16
+
17
+ File.open(tmpfile.path, 'w+') do |f|
18
+ f.puts input
19
+ unless message.nil?
20
+ f.puts message == :default ? '# First line is the entry title, lines after are added as a note' : message
24
21
  end
22
+ end
25
23
 
26
- pid = Process.fork { system("#{Util.editor_with_args} #{tmpfile.path}") }
24
+ pid = Process.fork { system("#{Util.editor_with_args} #{tmpfile.path}") }
27
25
 
28
- trap('INT') do
29
- begin
30
- Process.kill(9, pid)
31
- rescue StandardError
32
- Errno::ESRCH
33
- end
34
- tmpfile.unlink
35
- tmpfile.close!
36
- exit 0
26
+ trap('INT') do
27
+ begin
28
+ Process.kill(9, pid)
29
+ rescue StandardError
30
+ Errno::ESRCH
37
31
  end
32
+ tmpfile.unlink
33
+ tmpfile.close!
34
+ exit 0
35
+ end
38
36
 
39
- Process.wait(pid)
37
+ Process.wait(pid)
40
38
 
41
- begin
42
- if $?.exitstatus == 0
43
- input = IO.read(tmpfile.path)
44
- else
45
- exit_now! 'Cancelled'
46
- end
47
- ensure
48
- tmpfile.close
49
- tmpfile.unlink
39
+ begin
40
+ if $?.exitstatus == 0
41
+ input = IO.read(tmpfile.path)
42
+ else
43
+ exit_now! 'Cancelled'
50
44
  end
45
+ ensure
46
+ tmpfile.close
47
+ tmpfile.unlink
48
+ end
49
+
50
+ input.split(/\n/).delete_if(&:ignore?).join("\n")
51
+ end
51
52
 
52
- input.split(/\n/).delete_if(&:ignore?).join("\n")
53
+ ##
54
+ ## Takes a multi-line string and formats it as an entry
55
+ ##
56
+ ## @param input [String] The string to parse
57
+ ##
58
+ ## @return [Array] [[String]title, [Note]note]
59
+ ##
60
+ def format_input(input)
61
+ raise EmptyInput, 'No content in entry' if input.nil? || input.strip.empty?
62
+
63
+ input_lines = input.split(/[\n\r]+/).delete_if(&:ignore?)
64
+ title = input_lines[0]&.strip
65
+ raise EmptyInput, 'No content in first line' if title.nil? || title.strip.empty?
66
+
67
+ date = nil
68
+ iso_rx = /\d{4}-\d\d-\d\d \d\d:\d\d/
69
+ date_rx = /^(?:\s*- )?(?<date>.*?) \| (?=\S)/
70
+
71
+ raise EmptyInput, 'No content' if title.sub(/^.*?\| */, '').strip.empty?
72
+
73
+ title.expand_date_tags(Doing.setting('date_tags'))
74
+
75
+ if title =~ date_rx
76
+ m = title.match(date_rx)
77
+ d = m['date']
78
+ date = if d =~ iso_rx
79
+ Time.parse(d)
80
+ else
81
+ d.chronify(guess: :begin)
82
+ end
83
+ title.sub!(date_rx, '').strip!
53
84
  end
54
85
 
55
- ##
56
- ## Takes a multi-line string and formats it as an entry
57
- ##
58
- ## @param input [String] The string to parse
59
- ##
60
- ## @return [Array] [[String]title, [Note]note]
61
- ##
62
- def format_input(input)
63
- raise EmptyInput, 'No content in entry' if input.nil? || input.strip.empty?
64
-
65
- input_lines = input.split(/[\n\r]+/).delete_if(&:ignore?)
66
- title = input_lines[0]&.strip
67
- raise EmptyInput, 'No content in first line' if title.nil? || title.strip.empty?
68
-
69
- date = nil
70
- iso_rx = /\d{4}-\d\d-\d\d \d\d:\d\d/
71
- date_rx = /^(?:\s*- )?(?<date>.*?) \| (?=\S)/
72
-
73
- raise EmptyInput, 'No content' if title.sub(/^.*?\| */, '').strip.empty?
74
-
75
- title.expand_date_tags(Doing.setting('date_tags'))
76
-
77
- if title =~ date_rx
78
- m = title.match(date_rx)
79
- d = m['date']
80
- date = if d =~ iso_rx
81
- Time.parse(d)
82
- else
83
- d.chronify(guess: :begin)
84
- end
85
- title.sub!(date_rx, '').strip!
86
+ note = Note.new
87
+ note.add(input_lines[1..-1]) if input_lines.length > 1
88
+ # If title line ends in a parenthetical, use that as the note
89
+ if note.empty? && title =~ /\s+\(.*?\)$/
90
+ title.sub!(/\s+\((?<note>.*?)\)$/) do
91
+ m = Regexp.last_match
92
+ note.add(m['note'])
93
+ ''
86
94
  end
95
+ end
87
96
 
88
- note = Note.new
89
- note.add(input_lines[1..-1]) if input_lines.length > 1
90
- # If title line ends in a parenthetical, use that as the note
91
- if note.empty? && title =~ /\s+\(.*?\)$/
92
- title.sub!(/\s+\((?<note>.*?)\)$/) do
93
- m = Regexp.last_match
94
- note.add(m['note'])
95
- ''
96
- end
97
- end
97
+ note.strip_lines!
98
+ note.compress
98
99
 
99
- note.strip_lines!
100
- note.compress
100
+ [date, title, note]
101
+ end
101
102
 
102
- [date, title, note]
103
- end
103
+ def add_with_editor(**options)
104
+ raise MissingEditor, 'No EDITOR variable defined in environment' if Util.default_editor.nil?
104
105
 
105
- def add_with_editor(**options)
106
- raise MissingEditor, 'No EDITOR variable defined in environment' if Util.default_editor.nil?
106
+ input = options[:date].strftime('%F %R | ')
107
+ input += options[:title]
108
+ input += "\n#{options[:note]}" if options[:note]
109
+ input = fork_editor(input).strip
107
110
 
108
- input = options[:date].strftime('%F %R | ')
109
- input += options[:title]
110
- input += "\n#{options[:note]}" if options[:note]
111
- input = fork_editor(input).strip
111
+ d, title, note = format_input(input)
112
+ raise EmptyInput, 'No content' if title.empty?
112
113
 
113
- d, title, note = format_input(input)
114
- raise EmptyInput, 'No content' if title.empty?
114
+ if options[:ask]
115
+ ask_note = Doing::Prompt.read_lines(prompt: 'Add a note')
116
+ note.add(ask_note) unless ask_note.empty?
117
+ end
115
118
 
116
- if options[:ask]
117
- ask_note = Doing::Prompt.read_lines(prompt: 'Add a note')
118
- note.add(ask_note) unless ask_note.empty?
119
- end
119
+ date = d.nil? ? options[:date] : d
120
+ finish = options[:finish_last] || false
121
+ add_item(title.cap_first, options[:section], { note: note, back: date, timed: finish })
122
+ write(@doing_file)
123
+ end
120
124
 
121
- date = d.nil? ? options[:date] : d
122
- finish = options[:finish_last] || false
123
- add_item(title.cap_first, options[:section], { note: note, back: date, timed: finish })
124
- write(@doing_file)
125
- end
125
+ def edit_items(items)
126
+ items.sort_by! { |i| i.date }
127
+ editable_items = []
126
128
 
127
- def edit_items(items)
128
- items.sort_by! { |i| i.date }
129
- editable_items = []
129
+ items.each do |i|
130
+ editable = "#{i.date.strftime('%F %R')} | #{i.title}"
131
+ old_note = i.note ? i.note.strip_lines.join("\n") : nil
132
+ editable += "\n#{old_note}" unless old_note.nil?
133
+ editable_items << editable
134
+ end
135
+ divider = "-----------"
136
+ notice =<<~EONOTICE
137
+ # - You may delete entries, but leave all divider lines (---) in place.
138
+ # - Start and @done dates replaced with a time string (yesterday 3pm) will
139
+ # be parsed automatically. Do not delete the pipe (|) between start date
140
+ # and entry title.
141
+ EONOTICE
142
+ input = "#{editable_items.map(&:strip).join("\n#{divider}\n")}\n\n#{notice}"
143
+
144
+ new_items = fork_editor(input).split(/^#{divider}/).map(&:strip)
145
+
146
+ new_items.each_with_index do |new_item, i|
147
+ input_lines = new_item.split(/[\n\r]+/).delete_if(&:ignore?)
148
+ first_line = input_lines[0]&.strip
149
+
150
+ if first_line.nil? || first_line =~ /^#{divider.strip}$/ || first_line.strip.empty?
151
+ deleted = @content.delete_item(items[i], single: new_items.count == 1)
152
+ Hooks.trigger :post_entry_removed, self, deleted
153
+ Doing.logger.info('Deleted:', deleted.title)
154
+ else
155
+ date, title, note = format_input(new_item)
130
156
 
131
- items.each do |i|
132
- editable = "#{i.date.strftime('%F %R')} | #{i.title}"
133
- old_note = i.note ? i.note.strip_lines.join("\n") : nil
134
- editable += "\n#{old_note}" unless old_note.nil?
135
- editable_items << editable
136
- end
137
- divider = "-----------"
138
- notice =<<~EONOTICE
139
- # - You may delete entries, but leave all divider lines (---) in place.
140
- # - Start and @done dates replaced with a time string (yesterday 3pm) will
141
- # be parsed automatically. Do not delete the pipe (|) between start date
142
- # and entry title.
143
- EONOTICE
144
- input = "#{editable_items.map(&:strip).join("\n#{divider}\n")}\n\n#{notice}"
145
-
146
- new_items = fork_editor(input).split(/^#{divider}/).map(&:strip)
147
-
148
- new_items.each_with_index do |new_item, i|
149
- input_lines = new_item.split(/[\n\r]+/).delete_if(&:ignore?)
150
- first_line = input_lines[0]&.strip
151
-
152
- if first_line.nil? || first_line =~ /^#{divider.strip}$/ || first_line.strip.empty?
153
- deleted = @content.delete_item(items[i], single: new_items.count == 1)
154
- Hooks.trigger :post_entry_removed, self, deleted
155
- Doing.logger.info('Deleted:', deleted.title)
157
+ note.map!(&:strip)
158
+ note.delete_if(&:ignore?)
159
+ item = items[i]
160
+ old_item = item.clone
161
+ item.date = date || items[i].date
162
+ item.title = title
163
+ item.note = note
164
+ if (item.equal?(old_item))
165
+ Doing.logger.count(:skipped, level: :debug)
156
166
  else
157
- date, title, note = format_input(new_item)
158
-
159
- note.map!(&:strip)
160
- note.delete_if(&:ignore?)
161
- item = items[i]
162
- old_item = item.clone
163
- item.date = date || items[i].date
164
- item.title = title
165
- item.note = note
166
- if (item.equal?(old_item))
167
- Doing.logger.count(:skipped, level: :debug)
168
- else
169
- Doing.logger.count(:updated)
170
- Hooks.trigger :post_entry_updated, self, item, old_item
171
- end
167
+ Doing.logger.count(:updated)
168
+ Hooks.trigger :post_entry_updated, self, item, old_item
172
169
  end
173
170
  end
174
171
  end
172
+ end
175
173
 
176
- ##
177
- ## Edit the last entry
178
- ##
179
- ## @param section [String] The section, default "All"
180
- ##
181
- def edit_last(section: 'All', options: {})
182
- options[:section] = guess_section(section)
174
+ ##
175
+ ## Edit the last entry
176
+ ##
177
+ ## @param section [String] The section, default "All"
178
+ ##
179
+ def edit_last(section: 'All', options: {})
180
+ options[:section] = guess_section(section)
183
181
 
184
- item = last_entry(options)
182
+ item = last_entry(options)
185
183
 
186
- if item.nil?
187
- logger.debug('Skipped:', 'No entries found')
188
- return
189
- end
184
+ if item.nil?
185
+ logger.debug('Skipped:', 'No entries found')
186
+ return
187
+ end
190
188
 
191
- old_item = item.clone
192
- content = ["#{item.date.strftime('%F %R')} | #{item.title.dup}"]
193
- content << item.note.strip_lines.join("\n") unless item.note.empty?
194
- new_item = fork_editor(content.join("\n"))
195
- date, title, note = format_input(new_item)
196
- date ||= item.date
197
-
198
- if title.nil? || title.empty?
199
- logger.debug('Skipped:', 'No content provided')
200
- elsif title == item.title && note.equal?(item.note) && date.equal?(item.date)
201
- logger.debug('Skipped:', 'No change in content')
202
- else
203
- item.date = date unless date.nil?
204
- item.title = title
205
- item.note.add(note, replace: true)
206
- logger.info('Edited:', item.title)
207
- Hooks.trigger :post_entry_updated, self, item, old_item
189
+ old_item = item.clone
190
+ content = ["#{item.date.strftime('%F %R')} | #{item.title.dup}"]
191
+ content << item.note.strip_lines.join("\n") unless item.note.empty?
192
+ new_item = fork_editor(content.join("\n"))
193
+ date, title, note = format_input(new_item)
194
+ date ||= item.date
195
+
196
+ if title.nil? || title.empty?
197
+ logger.debug('Skipped:', 'No content provided')
198
+ elsif title == item.title && note.equal?(item.note) && date.equal?(item.date)
199
+ logger.debug('Skipped:', 'No change in content')
200
+ else
201
+ item.date = date unless date.nil?
202
+ item.title = title
203
+ item.note.add(note, replace: true)
204
+ logger.info('Edited:', item.title)
205
+ Hooks.trigger :post_entry_updated, self, item, old_item
208
206
 
209
- write(@doing_file)
210
- end
207
+ write(@doing_file)
211
208
  end
212
209
  end
213
210
  end