doing 2.1.41 → 2.1.44

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +67 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +1 -1
  5. data/bin/commands/again.rb +1 -3
  6. data/bin/commands/changes.rb +60 -34
  7. data/bin/commands/commands.rb +77 -52
  8. data/bin/commands/commands_accepting.rb +57 -53
  9. data/bin/commands/config.rb +2 -2
  10. data/bin/commands/finish.rb +94 -68
  11. data/bin/commands/flag.rb +5 -1
  12. data/bin/commands/grep.rb +12 -2
  13. data/bin/commands/last.rb +2 -0
  14. data/bin/commands/now.rb +151 -107
  15. data/bin/commands/on.rb +20 -5
  16. data/bin/commands/recent.rb +4 -1
  17. data/bin/commands/show.rb +8 -0
  18. data/bin/commands/since.rb +6 -2
  19. data/bin/commands/template.rb +14 -25
  20. data/bin/commands/today.rb +4 -1
  21. data/bin/commands/undo.rb +4 -6
  22. data/bin/commands/view.rb +36 -73
  23. data/bin/commands/views.rb +102 -5
  24. data/bin/commands/yesterday.rb +3 -1
  25. data/bin/doing +31 -4
  26. data/docs/doc/Array.html +14 -3
  27. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  28. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  29. data/docs/doc/BooleanTermParser/Query.html +1 -1
  30. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  31. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  32. data/docs/doc/BooleanTermParser.html +1 -1
  33. data/docs/doc/Doing/ArrayCleanup.html +316 -0
  34. data/docs/doc/Doing/ArrayNestedHash.html +1 -1
  35. data/docs/doc/Doing/ArrayTags.html +1 -1
  36. data/docs/doc/Doing/CSVExport.html +1 -1
  37. data/docs/doc/Doing/CalendarImport.html +1 -1
  38. data/docs/doc/Doing/Change.html +74 -3
  39. data/docs/doc/Doing/Changes.html +3 -3
  40. data/docs/doc/Doing/ChronifyArray.html +1 -1
  41. data/docs/doc/Doing/ChronifyNumeric.html +1 -1
  42. data/docs/doc/Doing/ChronifyString.html +1 -1
  43. data/docs/doc/Doing/Color.html +1 -1
  44. data/docs/doc/Doing/Completion/BashCompletions.html +1 -1
  45. data/docs/doc/Doing/Completion/FishCompletions.html +1 -1
  46. data/docs/doc/Doing/Completion/StringUtils.html +1 -1
  47. data/docs/doc/Doing/Completion/ZshCompletions.html +1 -1
  48. data/docs/doc/Doing/Completion.html +1 -1
  49. data/docs/doc/Doing/Configuration.html +82 -2
  50. data/docs/doc/Doing/DayOneRenderer.html +1 -1
  51. data/docs/doc/Doing/DayoneExport.html +1 -1
  52. data/docs/doc/Doing/DoingImport.html +1 -1
  53. data/docs/doc/Doing/Entry.html +109 -4
  54. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  55. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  56. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  57. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  58. data/docs/doc/Doing/Errors/HistoryLimitError.html +1 -1
  59. data/docs/doc/Doing/Errors/InvalidPlugin.html +1 -1
  60. data/docs/doc/Doing/Errors/MissingBackupFile.html +1 -1
  61. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  62. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  63. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  64. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  65. data/docs/doc/Doing/Errors.html +1 -1
  66. data/docs/doc/Doing/HTMLExport.html +1 -1
  67. data/docs/doc/Doing/Hooks.html +1 -1
  68. data/docs/doc/Doing/Item.html +1 -1
  69. data/docs/doc/Doing/ItemDates.html +1 -1
  70. data/docs/doc/Doing/ItemQuery.html +1 -1
  71. data/docs/doc/Doing/ItemState.html +1 -1
  72. data/docs/doc/Doing/ItemTags.html +1 -1
  73. data/docs/doc/Doing/Items.html +2 -1
  74. data/docs/doc/Doing/JSONExport.html +1 -1
  75. data/docs/doc/Doing/Logger.html +1 -1
  76. data/docs/doc/Doing/MarkdownExport.html +1 -1
  77. data/docs/doc/Doing/Note.html +3 -2
  78. data/docs/doc/Doing/Pager.html +1 -1
  79. data/docs/doc/Doing/Plugins.html +181 -76
  80. data/docs/doc/Doing/Prompt.html +1 -1
  81. data/docs/doc/Doing/PromptChoose.html +1 -1
  82. data/docs/doc/Doing/PromptFZF.html +1 -1
  83. data/docs/doc/Doing/PromptInput.html +1 -1
  84. data/docs/doc/Doing/PromptSTD.html +1 -1
  85. data/docs/doc/Doing/PromptYN.html +1 -1
  86. data/docs/doc/Doing/Section.html +1 -1
  87. data/docs/doc/Doing/StringHighlight.html +1 -1
  88. data/docs/doc/Doing/StringNormalize.html +35 -1
  89. data/docs/doc/Doing/StringQuery.html +1 -1
  90. data/docs/doc/Doing/StringTags.html +1 -1
  91. data/docs/doc/Doing/StringTransform.html +35 -1
  92. data/docs/doc/Doing/StringTruncate.html +1 -1
  93. data/docs/doc/Doing/StringURL.html +1 -1
  94. data/docs/doc/Doing/SymbolNormalize.html +1 -1
  95. data/docs/doc/Doing/TaskPaperExport.html +1 -1
  96. data/docs/doc/Doing/TemplateExport.html +1 -1
  97. data/docs/doc/Doing/TemplateString.html +3 -3
  98. data/docs/doc/Doing/TimingImport.html +1 -1
  99. data/docs/doc/Doing/Types.html +23 -18
  100. data/docs/doc/Doing/Util/Backup.html +2 -156
  101. data/docs/doc/Doing/Util.html +66 -9
  102. data/docs/doc/Doing/Version.html +1 -1
  103. data/docs/doc/Doing/WWID.html +84 -3
  104. data/docs/doc/Doing.html +4 -4
  105. data/docs/doc/FalseClass.html +11 -1
  106. data/docs/doc/GLI/Commands/Help.html +1 -1
  107. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  108. data/docs/doc/GLI/Commands.html +1 -1
  109. data/docs/doc/GLI.html +1 -1
  110. data/docs/doc/Hash.html +461 -6
  111. data/docs/doc/Numeric.html +1 -1
  112. data/docs/doc/Object.html +1 -1
  113. data/docs/doc/PhraseParser/Operator.html +1 -1
  114. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  115. data/docs/doc/PhraseParser/Query.html +1 -1
  116. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  117. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  118. data/docs/doc/PhraseParser/TermClause.html +1 -1
  119. data/docs/doc/PhraseParser.html +1 -1
  120. data/docs/doc/Status.html +1 -1
  121. data/docs/doc/String.html +5 -5
  122. data/docs/doc/Symbol.html +1 -1
  123. data/docs/doc/Time.html +68 -3
  124. data/docs/doc/TrueClass.html +11 -1
  125. data/docs/doc/_index.html +16 -9
  126. data/docs/doc/class_list.html +1 -1
  127. data/docs/doc/file.README.html +2 -2
  128. data/docs/doc/index.html +2 -2
  129. data/docs/doc/method_list.html +529 -417
  130. data/docs/doc/top-level-namespace.html +11 -1
  131. data/doing.rdoc +169 -13
  132. data/lib/completion/_doing.zsh +13 -13
  133. data/lib/completion/doing.bash +22 -22
  134. data/lib/completion/doing.fish +24 -1
  135. data/lib/doing/add_options.rb +48 -1
  136. data/lib/doing/array/array.rb +2 -0
  137. data/lib/doing/array/cleanup.rb +31 -0
  138. data/lib/doing/changelog/change.rb +13 -5
  139. data/lib/doing/changelog/changes.rb +11 -2
  140. data/lib/doing/changelog/entry.rb +9 -2
  141. data/lib/doing/configuration.rb +28 -3
  142. data/lib/doing/good.rb +18 -1
  143. data/lib/doing/hash.rb +126 -22
  144. data/lib/doing/normalize.rb +13 -0
  145. data/lib/doing/note.rb +1 -1
  146. data/lib/doing/pager.rb +9 -3
  147. data/lib/doing/plugin_manager.rb +30 -5
  148. data/lib/doing/prompt/choose.rb +1 -1
  149. data/lib/doing/prompt/input.rb +1 -1
  150. data/lib/doing/string/transform.rb +6 -0
  151. data/lib/doing/types.rb +9 -8
  152. data/lib/doing/util.rb +12 -6
  153. data/lib/doing/util_backup.rb +55 -48
  154. data/lib/doing/version.rb +1 -1
  155. data/lib/doing/wwid/display.rb +4 -1
  156. data/lib/doing/wwid/editor.rb +6 -3
  157. data/lib/doing/wwid/interactive.rb +10 -20
  158. data/lib/doing/wwid/modify.rb +2 -0
  159. data/lib/doing/wwid/wwid.rb +21 -3
  160. data/lib/doing.rb +12 -3
  161. metadata +4 -2
@@ -12,7 +12,7 @@ module Doing
12
12
 
13
13
  raise MissingEditor, 'No EDITOR variable defined in environment' if Util.default_editor.nil?
14
14
 
15
- tmpfile = Tempfile.new(['doing', '.txt'])
15
+ tmpfile = Tempfile.new(['doing_temp', '.doing'])
16
16
 
17
17
  File.open(tmpfile.path, 'w+') do |f|
18
18
  f.puts input
@@ -134,14 +134,15 @@ module Doing
134
134
  end
135
135
  divider = "-----------"
136
136
  notice =<<~EONOTICE
137
+
137
138
  # - You may delete entries, but leave all divider lines (---) in place.
138
139
  # - Start and @done dates replaced with a time string (yesterday 3pm) will
139
140
  # be parsed automatically. Do not delete the pipe (|) between start date
140
141
  # and entry title.
141
142
  EONOTICE
142
- input = "#{editable_items.map(&:strip).join("\n#{divider}\n")}\n\n#{notice}"
143
+ input = "#{editable_items.map(&:strip).join("\n#{divider}\n")}\n"
143
144
 
144
- new_items = fork_editor(input).split(/^#{divider}/).map(&:strip)
145
+ new_items = fork_editor(input, message: notice).split(/^#{divider}/).map(&:strip)
145
146
 
146
147
  new_items.each_with_index do |new_item, i|
147
148
  input_lines = new_item.split(/[\n\r]+/).delete_if(&:ignore?)
@@ -190,6 +191,8 @@ module Doing
190
191
  content = ["#{item.date.strftime('%F %R')} | #{item.title.dup}"]
191
192
  content << item.note.strip_lines.join("\n") unless item.note.empty?
192
193
  new_item = fork_editor(content.join("\n"))
194
+ raise UserCancelled, 'No change' if new_item.strip == content.join("\n").strip
195
+
193
196
  date, title, note = format_input(new_item)
194
197
  date ||= item.date
195
198
 
@@ -92,22 +92,21 @@ module Doing
92
92
 
93
93
  actions.concat(['resume/repeat', 'begin/reset']) if items.count == 1
94
94
 
95
- choice = Prompt.choose_from(actions,
95
+ choice = Prompt.choose_from(actions.map(&:titlecase),
96
96
  prompt: 'What do you want to do with the selected items? > ',
97
97
  multiple: true,
98
98
  sorted: false,
99
99
  fzf_args: ["--height=#{actions.count + 3}", '--tac', '--no-sort', '--info=hidden'])
100
100
  return unless choice
101
101
 
102
- to_do = choice.strip.split(/\n/)
102
+ to_do = choice.strip.split(/\n/).map(&:downcase)
103
+
103
104
  to_do.each do |action|
104
105
  case action
105
- when /resume/
106
- opt[:resume] = true
107
- when /reset/
108
- opt[:reset] = true
109
- when /autotag/
110
- opt[:autotag] = true
106
+ when /(resume|reset|autotag|archive|delete|finish|cancel|flag)/
107
+ opt[action.to_sym] = true
108
+ when /edit/
109
+ opt[:editor] = true
111
110
  when /(add|remove) tag/
112
111
  type = action =~ /^add/ ? 'add' : 'remove'
113
112
  raise InvalidArgument, "'add tag' and 'remove tag' can not be used together" if opt[:tag]
@@ -149,21 +148,9 @@ module Doing
149
148
 
150
149
  opt[:save_to] = filename
151
150
  end
152
- when /archive/
153
- opt[:archive] = true
154
- when /delete/
155
- opt[:delete] = true
156
- when /edit/
157
- opt[:editor] = true
158
- when /finish/
159
- opt[:finish] = true
160
- when /cancel/
161
- opt[:cancel] = true
162
151
  when /move/
163
152
  section = choose_section.strip
164
153
  opt[:move] = section.strip unless section =~ /^ *$/
165
- when /flag/
166
- opt[:flag] = true
167
154
  end
168
155
  end
169
156
  end
@@ -263,6 +250,9 @@ module Doing
263
250
  write(@doing_file)
264
251
 
265
252
  if opt[:editor]
253
+ sleep 2 # This seems to be necessary between running fzf
254
+ # and forking the editor, otherwise vim gets all
255
+ # screwy and I can't figure out why
266
256
  edit_items(items) # hooked
267
257
 
268
258
  write(@doing_file)
@@ -509,6 +509,8 @@ module Doing
509
509
  new_tag = r
510
510
 
511
511
  m.to_a.slice(1, m.length - 1).each_with_index do |v, idx|
512
+ next if v.nil?
513
+
512
514
  new_tag.gsub!("\\#{idx + 1}", v)
513
515
  end
514
516
  # Replace original tag if /r
@@ -100,10 +100,28 @@ module Doing
100
100
  ##
101
101
  ## @param title [String] The title of the view to retrieve
102
102
  ##
103
- def get_view(title)
104
- return Doing.setting(['views', title], nil)
103
+ def get_view(title, fallback: nil)
104
+ Doing.setting(['views', title], fallback)
105
+ end
106
+
107
+ def rename_view_keys(view)
108
+ options = view.symbolize_keys
109
+ # options.rename_key(:tags, :tag, keep: true)
110
+ options.rename_key(:output_format, :output)
111
+ options.rename_key(:tags_bool, :bool)
112
+ options.rename_key(:tag_sort, :sort_tags)
113
+ options.rename_key(:negate, :not)
114
+ options.rename_key(:order, :sort)
115
+
116
+ options
117
+ end
105
118
 
106
- false
119
+ def view_to_options(title)
120
+ view = rename_view_keys(get_view(guess_view(title)))
121
+ view.deep_merge(rename_view_keys(get_view(guess_view(view[:parent]), fallback: {}))) if view.key?(:parent)
122
+ view.deep_merge(rename_view_keys(get_view(view[:config_template], fallback: {}))) if view.key?(:config_template)
123
+ view.deep_merge(Doing.setting('templates.default').symbolize_keys)
124
+ view
107
125
  end
108
126
 
109
127
  private
data/lib/doing.rb CHANGED
@@ -24,10 +24,9 @@ require 'tty-markdown'
24
24
  require 'tty-reader'
25
25
  require 'tty-screen'
26
26
 
27
- require_relative 'doing/changelog/changelog'
28
- require_relative 'doing/hash'
29
- require_relative 'doing/types'
30
27
  require_relative 'doing/colors'
28
+ require_relative 'doing/types'
29
+ require_relative 'doing/hash'
31
30
  require_relative 'doing/template_string'
32
31
  require_relative 'doing/string/string'
33
32
  require_relative 'doing/time'
@@ -35,6 +34,7 @@ require_relative 'doing/array/array'
35
34
  require_relative 'doing/good'
36
35
  require_relative 'doing/normalize'
37
36
  require_relative 'doing/util'
37
+ require_relative 'doing/changelog/changelog'
38
38
  require_relative 'doing/util_backup'
39
39
  require_relative 'doing/configuration'
40
40
  require_relative 'doing/section'
@@ -85,6 +85,15 @@ module Doing
85
85
  config.settings
86
86
  end
87
87
 
88
+ def original_options
89
+ @original_options ||= {
90
+ date_begin: nil,
91
+ date_end: nil,
92
+ date_range: nil,
93
+ date_interval: nil
94
+ }
95
+ end
96
+
88
97
  ##
89
98
  ## Fetch a config setting using a dot-separated keypath
90
99
  ## or array of keys
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.41
4
+ version: 2.1.44
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-03-16 00:00:00.000000000 Z
11
+ date: 2022-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-markup
@@ -489,6 +489,7 @@ files:
489
489
  - docs/doc/BooleanTermParser/QueryParser.html
490
490
  - docs/doc/BooleanTermParser/QueryTransformer.html
491
491
  - docs/doc/Doing.html
492
+ - docs/doc/Doing/ArrayCleanup.html
492
493
  - docs/doc/Doing/ArrayNestedHash.html
493
494
  - docs/doc/Doing/ArrayTags.html
494
495
  - docs/doc/Doing/CLIFormat.html
@@ -623,6 +624,7 @@ files:
623
624
  - lib/doing.rb
624
625
  - lib/doing/add_options.rb
625
626
  - lib/doing/array/array.rb
627
+ - lib/doing/array/cleanup.rb
626
628
  - lib/doing/array/nested_hash.rb
627
629
  - lib/doing/array/tags.rb
628
630
  - lib/doing/boolean_term_parser.rb