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
@@ -61,9 +61,9 @@ _doing_cancel() {
61
61
  _doing_changes() {
62
62
 
63
63
  if [[ "$token" == --* ]]; then
64
- COMPREPLY=( $( compgen -W '--changes --all --interactive --lookup --markdown --render --search --sort' -- $token ) )
64
+ COMPREPLY=( $( compgen -W '--changes --all --interactive --lookup --markdown --only --prefix --render --search --sort' -- $token ) )
65
65
  elif [[ "$token" == -* ]]; then
66
- COMPREPLY=( $( compgen -W '-C -a -i -l -s --changes --all --interactive --lookup --markdown --render --search --sort' -- $token ) )
66
+ COMPREPLY=( $( compgen -W '-C -a -i -l -p -s --changes --all --interactive --lookup --markdown --only --prefix --render --search --sort' -- $token ) )
67
67
 
68
68
  fi
69
69
  }
@@ -111,9 +111,9 @@ _doing_finish() {
111
111
  _doing_grep() {
112
112
 
113
113
  if [[ "$token" == --* ]]; then
114
- COMPREPLY=( $( compgen -W '--after --before --bool --case --config_template --delete --duration --editor --from --hilite --interactive --not --output --only_timed --section --times --tag --tag_order --tag_sort --template --totals --val --exact' -- $token ) )
114
+ COMPREPLY=( $( compgen -W '--after --before --bool --case --config_template --delete --duration --editor --from --hilite --interactive --not --output --only_timed --section --save --times --tag --tag_order --tag_sort --template --title --totals --val --exact' -- $token ) )
115
115
  elif [[ "$token" == -* ]]; then
116
- COMPREPLY=( $( compgen -W '-d -e -h -i -o -s -t -x --after --before --bool --case --config_template --delete --duration --editor --from --hilite --interactive --not --output --only_timed --section --times --tag --tag_order --tag_sort --template --totals --val --exact' -- $token ) )
116
+ COMPREPLY=( $( compgen -W '-d -e -h -i -o -s -t -x --after --before --bool --case --config_template --delete --duration --editor --from --hilite --interactive --not --output --only_timed --section --save --times --tag --tag_order --tag_sort --template --title --totals --val --exact' -- $token ) )
117
117
 
118
118
  fi
119
119
  }
@@ -141,9 +141,9 @@ _doing_import() {
141
141
  _doing_last() {
142
142
 
143
143
  if [[ "$token" == --* ]]; then
144
- COMPREPLY=( $( compgen -W '--bool --case --config_template --delete --duration --editor --hilite --not --output --section --search --tag --template --val --exact' -- $token ) )
144
+ COMPREPLY=( $( compgen -W '--bool --case --config_template --delete --duration --editor --hilite --not --output --section --save --search --tag --template --title --val --exact' -- $token ) )
145
145
  elif [[ "$token" == -* ]]; then
146
- COMPREPLY=( $( compgen -W '-d -e -h -o -s -x --bool --case --config_template --delete --duration --editor --hilite --not --output --section --search --tag --template --val --exact' -- $token ) )
146
+ COMPREPLY=( $( compgen -W '-d -e -h -o -s -x --bool --case --config_template --delete --duration --editor --hilite --not --output --section --save --search --tag --template --title --val --exact' -- $token ) )
147
147
 
148
148
  fi
149
149
  }
@@ -191,9 +191,9 @@ _doing_now() {
191
191
  _doing_on() {
192
192
 
193
193
  if [[ "$token" == --* ]]; then
194
- COMPREPLY=( $( compgen -W '--after --before --bool --case --config_template --duration --from --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --template --totals --val --exact' -- $token ) )
194
+ COMPREPLY=( $( compgen -W '--after --before --bool --case --config_template --duration --from --not --output --only_timed --section --save --search --times --tag --tag_order --tag_sort --template --title --totals --val --exact' -- $token ) )
195
195
  elif [[ "$token" == -* ]]; then
196
- COMPREPLY=( $( compgen -W '-o -s -t -x --after --before --bool --case --config_template --duration --from --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --template --totals --val --exact' -- $token ) )
196
+ COMPREPLY=( $( compgen -W '-o -s -t -x --after --before --bool --case --config_template --duration --from --not --output --only_timed --section --save --search --times --tag --tag_order --tag_sort --template --title --totals --val --exact' -- $token ) )
197
197
 
198
198
  fi
199
199
  }
@@ -221,9 +221,9 @@ _doing_plugins() {
221
221
  _doing_recent() {
222
222
 
223
223
  if [[ "$token" == --* ]]; then
224
- COMPREPLY=( $( compgen -W '--config_template --duration --interactive --output --only_timed --section --times --tag_order --tag_sort --template --totals' -- $token ) )
224
+ COMPREPLY=( $( compgen -W '--config_template --duration --interactive --output --only_timed --section --save --times --tag_order --tag_sort --template --title --totals' -- $token ) )
225
225
  elif [[ "$token" == -* ]]; then
226
- COMPREPLY=( $( compgen -W '-i -o -s -t --config_template --duration --interactive --output --only_timed --section --times --tag_order --tag_sort --template --totals' -- $token ) )
226
+ COMPREPLY=( $( compgen -W '-i -o -s -t --config_template --duration --interactive --output --only_timed --section --save --times --tag_order --tag_sort --template --title --totals' -- $token ) )
227
227
 
228
228
  fi
229
229
  }
@@ -276,9 +276,9 @@ local words=$(doing sections)
276
276
  IFS="$OLD_IFS"
277
277
 
278
278
  if [[ "$token" == --* ]]; then
279
- COMPREPLY=( $( compgen -W '--age --after --before --bool --count --case --config_template --duration --editor --from --hilite --interactive --menu --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --template --totals --val --exact' -- $token ) )
279
+ COMPREPLY=( $( compgen -W '--age --after --before --bool --count --case --config_template --duration --editor --from --hilite --interactive --menu --not --output --only_timed --sort --save --search --times --tag --tag_order --tag_sort --template --title --totals --val --exact' -- $token ) )
280
280
  elif [[ "$token" == -* ]]; then
281
- COMPREPLY=( $( compgen -W '-a -c -e -h -i -m -o -s -t -x --age --after --before --bool --count --case --config_template --duration --editor --from --hilite --interactive --menu --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --template --totals --val --exact' -- $token ) )
281
+ COMPREPLY=( $( compgen -W '-a -c -e -h -i -m -o -s -t -x --age --after --before --bool --count --case --config_template --duration --editor --from --hilite --interactive --menu --not --output --only_timed --sort --save --search --times --tag --tag_order --tag_sort --template --title --totals --val --exact' -- $token ) )
282
282
  else
283
283
  local nocasematchWasOff=0
284
284
  shopt nocasematch >/dev/null || nocasematchWasOff=1
@@ -301,9 +301,9 @@ IFS="$OLD_IFS"
301
301
  _doing_since() {
302
302
 
303
303
  if [[ "$token" == --* ]]; then
304
- COMPREPLY=( $( compgen -W '--bool --case --config_template --duration --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --template --totals --val --exact' -- $token ) )
304
+ COMPREPLY=( $( compgen -W '--bool --case --config_template --duration --not --output --only_timed --section --save --search --times --tag --tag_order --tag_sort --template --title --totals --val --exact' -- $token ) )
305
305
  elif [[ "$token" == -* ]]; then
306
- COMPREPLY=( $( compgen -W '-o -s -t -x --bool --case --config_template --duration --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --template --totals --val --exact' -- $token ) )
306
+ COMPREPLY=( $( compgen -W '-o -s -t -x --bool --case --config_template --duration --not --output --only_timed --section --save --search --times --tag --tag_order --tag_sort --template --title --totals --val --exact' -- $token ) )
307
307
 
308
308
  fi
309
309
  }
@@ -351,9 +351,9 @@ _doing_template() {
351
351
  _doing_today() {
352
352
 
353
353
  if [[ "$token" == --* ]]; then
354
- COMPREPLY=( $( compgen -W '--after --before --config_template --duration --from --output --only_timed --section --times --tag_order --tag_sort --template --totals' -- $token ) )
354
+ COMPREPLY=( $( compgen -W '--after --before --config_template --duration --from --output --only_timed --section --save --times --tag_order --tag_sort --template --title --totals' -- $token ) )
355
355
  elif [[ "$token" == -* ]]; then
356
- COMPREPLY=( $( compgen -W '-o -s -t --after --before --config_template --duration --from --output --only_timed --section --times --tag_order --tag_sort --template --totals' -- $token ) )
356
+ COMPREPLY=( $( compgen -W '-o -s -t --after --before --config_template --duration --from --output --only_timed --section --save --times --tag_order --tag_sort --template --title --totals' -- $token ) )
357
357
 
358
358
  fi
359
359
  }
@@ -376,9 +376,9 @@ local words=$(doing views)
376
376
  IFS="$OLD_IFS"
377
377
 
378
378
  if [[ "$token" == --* ]]; then
379
- COMPREPLY=( $( compgen -W '--after --age --before --bool --count --case --color --duration --from --hilite --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
379
+ COMPREPLY=( $( compgen -W '--after --age --before --bool --count --case --color --config_template --duration --from --hilite --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --template --totals --val --exact' -- $token ) )
380
380
  elif [[ "$token" == -* ]]; then
381
- COMPREPLY=( $( compgen -W '-c -h -i -o -s -t -x --after --age --before --bool --count --case --color --duration --from --hilite --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
381
+ COMPREPLY=( $( compgen -W '-c -h -i -o -s -t -x --after --age --before --bool --count --case --color --config_template --duration --from --hilite --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --template --totals --val --exact' -- $token ) )
382
382
  else
383
383
  local nocasematchWasOff=0
384
384
  shopt nocasematch >/dev/null || nocasematchWasOff=1
@@ -401,9 +401,9 @@ IFS="$OLD_IFS"
401
401
  _doing_views() {
402
402
 
403
403
  if [[ "$token" == --* ]]; then
404
- COMPREPLY=( $( compgen -W '--column' -- $token ) )
404
+ COMPREPLY=( $( compgen -W '--column --editor --output --remove' -- $token ) )
405
405
  elif [[ "$token" == -* ]]; then
406
- COMPREPLY=( $( compgen -W '-c --column' -- $token ) )
406
+ COMPREPLY=( $( compgen -W '-c -e -o -r --column --editor --output --remove' -- $token ) )
407
407
 
408
408
  fi
409
409
  }
@@ -421,9 +421,9 @@ _doing_wiki() {
421
421
  _doing_yesterday() {
422
422
 
423
423
  if [[ "$token" == --* ]]; then
424
- COMPREPLY=( $( compgen -W '--after --before --config_template --duration --from --output --only_timed --section --times --tag_order --tag_sort --template --totals' -- $token ) )
424
+ COMPREPLY=( $( compgen -W '--after --before --config_template --duration --from --output --only_timed --section --save --times --tag_order --tag_sort --template --title --totals' -- $token ) )
425
425
  elif [[ "$token" == -* ]]; then
426
- COMPREPLY=( $( compgen -W '-o -s -t --after --before --config_template --duration --from --output --only_timed --section --times --tag_order --tag_sort --template --totals' -- $token ) )
426
+ COMPREPLY=( $( compgen -W '-o -s -t --after --before --config_template --duration --from --output --only_timed --section --save --times --tag_order --tag_sort --template --title --totals' -- $token ) )
427
427
 
428
428
  fi
429
429
  }
@@ -228,6 +228,8 @@ complete -c doing -l all -s a -f -n '__fish_doing_using_command changes changel
228
228
  complete -c doing -l interactive -s i -f -n '__fish_doing_using_command changes changelog' -d Open\ changelog\ in\ interactive\ viewer
229
229
  complete -c doing -l lookup -s l -f -r -n '__fish_doing_using_command changes changelog' -d Look\ up\ a\ specific\ version
230
230
  complete -c doing -l markdown -f -n '__fish_doing_using_command changes changelog' -d Output\ raw\ Markdown
231
+ complete -c doing -l only -f -r -n '__fish_doing_using_command changes changelog' -d Only\ show\ changes\ of\ type\(s\)
232
+ complete -c doing -l prefix -s p -f -n '__fish_doing_using_command changes changelog' -d Include
231
233
  complete -c doing -l render -f -n '__fish_doing_using_command changes changelog' -d Force\ rendered\ output
232
234
  complete -c doing -l search -s s -f -r -n '__fish_doing_using_command changes changelog' -d Show\ changelogs\ matching\ search\ terms
233
235
  complete -c doing -l sort -f -r -n '__fish_doing_using_command changes changelog' -d Sort\ order
@@ -281,11 +283,13 @@ complete -c doing -l not -f -n '__fish_doing_using_command grep search' -d Sea
281
283
  complete -c doing -l output -s o -f -r -n '__fish_doing_using_command grep search' -d Output\ to\ export\ format
282
284
  complete -c doing -l only_timed -f -n '__fish_doing_using_command grep search' -d Only\ show\ items\ with\ recorded\ time\ intervals
283
285
  complete -c doing -l section -s s -f -r -n '__fish_doing_using_command grep search' -d Section
286
+ complete -c doing -l save -f -r -n '__fish_doing_using_command grep search' -d Save\ all\ current\ command\ line\ options\ as\ a\ new\ view
284
287
  complete -c doing -l times -s t -f -n '__fish_doing_using_command grep search' -d Show\ time\ intervals\ on\ @done\ tasks
285
288
  complete -c doing -l tag -f -r -n '__fish_doing_using_command grep search' -d Filter\ entries\ by\ tag
286
289
  complete -c doing -l tag_order -f -r -n '__fish_doing_using_command grep search' -d Tag\ sort\ direction
287
290
  complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command grep search' -d Sort\ tags\ by
288
291
  complete -c doing -l template -f -r -n '__fish_doing_using_command grep search' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
292
+ complete -c doing -l title -f -r -n '__fish_doing_using_command grep search' -d Title\ string\ to\ be\ used\ for\ output\ formats\ that\ require\ it
289
293
  complete -c doing -l totals -f -n '__fish_doing_using_command grep search' -d Show\ time\ totals\ at\ the\ end\ of\ output
290
294
  complete -c doing -l val -f -r -n '__fish_doing_using_command grep search' -d Perform\ a\ tag\ value\ query
291
295
  complete -c doing -l exact -s x -f -n '__fish_doing_using_command grep search' -d Force\ exact\ string\ matching
@@ -314,9 +318,11 @@ complete -c doing -l hilite -s h -f -n '__fish_doing_using_command last' -d Hig
314
318
  complete -c doing -l not -f -n '__fish_doing_using_command last' -d Show\ items\ that\ \*don\'t\*\ match\ search/tag\ filters
315
319
  complete -c doing -l output -s o -f -r -n '__fish_doing_using_command last' -d Output\ to\ export\ format
316
320
  complete -c doing -l section -s s -f -r -n '__fish_doing_using_command last' -d Specify\ a\ section
321
+ complete -c doing -l save -f -r -n '__fish_doing_using_command last' -d Save\ all\ current\ command\ line\ options\ as\ a\ new\ view
317
322
  complete -c doing -l search -f -r -n '__fish_doing_using_command last' -d Filter\ entries\ using\ a\ search\ query
318
323
  complete -c doing -l tag -f -r -n '__fish_doing_using_command last' -d Filter\ entries\ by\ tag
319
324
  complete -c doing -l template -f -r -n '__fish_doing_using_command last' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
325
+ complete -c doing -l title -f -r -n '__fish_doing_using_command last' -d Title\ string\ to\ be\ used\ for\ output\ formats\ that\ require\ it
320
326
  complete -c doing -l val -f -r -n '__fish_doing_using_command last' -d Perform\ a\ tag\ value\ query
321
327
  complete -c doing -l exact -s x -f -n '__fish_doing_using_command last' -d Force\ exact\ search\ string\ matching
322
328
  complete -c doing -l bool -f -r -n '__fish_doing_using_command mark flag' -d Boolean\ used\ to\ combine\ multiple\ tags
@@ -371,12 +377,14 @@ complete -c doing -l not -f -n '__fish_doing_using_command on' -d Show\ items\
371
377
  complete -c doing -l output -s o -f -r -n '__fish_doing_using_command on' -d Output\ to\ export\ format
372
378
  complete -c doing -l only_timed -f -n '__fish_doing_using_command on' -d Only\ show\ items\ with\ recorded\ time\ intervals
373
379
  complete -c doing -l section -s s -f -r -n '__fish_doing_using_command on' -d Section
380
+ complete -c doing -l save -f -r -n '__fish_doing_using_command on' -d Save\ all\ current\ command\ line\ options\ as\ a\ new\ view
374
381
  complete -c doing -l search -f -r -n '__fish_doing_using_command on' -d Filter\ entries\ using\ a\ search\ query
375
382
  complete -c doing -l times -s t -f -n '__fish_doing_using_command on' -d Show\ time\ intervals\ on\ @done\ tasks
376
383
  complete -c doing -l tag -f -r -n '__fish_doing_using_command on' -d Filter\ entries\ by\ tag
377
384
  complete -c doing -l tag_order -f -r -n '__fish_doing_using_command on' -d Tag\ sort\ direction
378
385
  complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command on' -d Sort\ tags\ by
379
386
  complete -c doing -l template -f -r -n '__fish_doing_using_command on' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
387
+ complete -c doing -l title -f -r -n '__fish_doing_using_command on' -d Title\ string\ to\ be\ used\ for\ output\ formats\ that\ require\ it
380
388
  complete -c doing -l totals -f -n '__fish_doing_using_command on' -d Show\ time\ totals\ at\ the\ end\ of\ output
381
389
  complete -c doing -l val -f -r -n '__fish_doing_using_command on' -d Perform\ a\ tag\ value\ query
382
390
  complete -c doing -l exact -s x -f -n '__fish_doing_using_command on' -d Force\ exact\ search\ string\ matching
@@ -391,10 +399,12 @@ complete -c doing -l interactive -s i -f -n '__fish_doing_using_command recent'
391
399
  complete -c doing -l output -s o -f -r -n '__fish_doing_using_command recent' -d Output\ to\ export\ format
392
400
  complete -c doing -l only_timed -f -n '__fish_doing_using_command recent' -d Only\ show\ items\ with\ recorded\ time\ intervals
393
401
  complete -c doing -l section -s s -f -r -n '__fish_doing_using_command recent' -d Section
402
+ complete -c doing -l save -f -r -n '__fish_doing_using_command recent' -d Save\ all\ current\ command\ line\ options\ as\ a\ new\ view
394
403
  complete -c doing -l times -s t -f -n '__fish_doing_using_command recent' -d Show\ time\ intervals\ on\ @done\ tasks
395
404
  complete -c doing -l tag_order -f -r -n '__fish_doing_using_command recent' -d Tag\ sort\ direction
396
405
  complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command recent' -d Sort\ tags\ by
397
406
  complete -c doing -l template -f -r -n '__fish_doing_using_command recent' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
407
+ complete -c doing -l title -f -r -n '__fish_doing_using_command recent' -d Title\ string\ to\ be\ used\ for\ output\ formats\ that\ require\ it
398
408
  complete -c doing -l totals -f -n '__fish_doing_using_command recent' -d Show\ time\ totals\ at\ the\ end\ of\ output
399
409
  complete -c doing -l file -s f -f -r -n '__fish_doing_using_command redo' -d Specify\ alternate\ doing\ file
400
410
  complete -c doing -l interactive -s i -f -n '__fish_doing_using_command redo' -d Select\ from\ an\ interactive\ menu
@@ -461,12 +471,14 @@ complete -c doing -l not -f -n '__fish_doing_using_command show' -d Show\ item
461
471
  complete -c doing -l output -s o -f -r -n '__fish_doing_using_command show' -d Output\ to\ export\ format
462
472
  complete -c doing -l only_timed -f -n '__fish_doing_using_command show' -d Only\ show\ items\ with\ recorded\ time\ intervals
463
473
  complete -c doing -l sort -s s -f -r -n '__fish_doing_using_command show' -d Sort\ order
474
+ complete -c doing -l save -f -r -n '__fish_doing_using_command show' -d Save\ all\ current\ command\ line\ options\ as\ a\ new\ view
464
475
  complete -c doing -l search -f -r -n '__fish_doing_using_command show' -d Filter\ entries\ using\ a\ search\ query
465
476
  complete -c doing -l times -s t -f -n '__fish_doing_using_command show' -d Show\ time\ intervals\ on\ @done\ tasks
466
477
  complete -c doing -l tag -f -r -n '__fish_doing_using_command show' -d Filter\ entries\ by\ tag
467
478
  complete -c doing -l tag_order -f -r -n '__fish_doing_using_command show' -d Tag\ sort\ direction
468
479
  complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command show' -d Sort\ tags\ by
469
480
  complete -c doing -l template -f -r -n '__fish_doing_using_command show' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
481
+ complete -c doing -l title -f -r -n '__fish_doing_using_command show' -d Title\ string\ to\ be\ used\ for\ output\ formats\ that\ require\ it
470
482
  complete -c doing -l totals -f -n '__fish_doing_using_command show' -d Show\ time\ totals\ at\ the\ end\ of\ output
471
483
  complete -c doing -l val -f -r -n '__fish_doing_using_command show' -d Perform\ a\ tag\ value\ query
472
484
  complete -c doing -l exact -s x -f -n '__fish_doing_using_command show' -d Force\ exact\ search\ string\ matching
@@ -478,12 +490,14 @@ complete -c doing -l not -f -n '__fish_doing_using_command since' -d Since\ it
478
490
  complete -c doing -l output -s o -f -r -n '__fish_doing_using_command since' -d Output\ to\ export\ format
479
491
  complete -c doing -l only_timed -f -n '__fish_doing_using_command since' -d Only\ show\ items\ with\ recorded\ time\ intervals
480
492
  complete -c doing -l section -s s -f -r -n '__fish_doing_using_command since' -d Section
493
+ complete -c doing -l save -f -r -n '__fish_doing_using_command since' -d Save\ all\ current\ command\ line\ options\ as\ a\ new\ view
481
494
  complete -c doing -l search -f -r -n '__fish_doing_using_command since' -d Filter\ entries\ using\ a\ search\ query
482
495
  complete -c doing -l times -s t -f -n '__fish_doing_using_command since' -d Show\ time\ intervals\ on\ @done\ tasks
483
496
  complete -c doing -l tag -f -r -n '__fish_doing_using_command since' -d Filter\ entries\ by\ tag
484
497
  complete -c doing -l tag_order -f -r -n '__fish_doing_using_command since' -d Tag\ sort\ direction
485
498
  complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command since' -d Sort\ tags\ by
486
499
  complete -c doing -l template -f -r -n '__fish_doing_using_command since' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
500
+ complete -c doing -l title -f -r -n '__fish_doing_using_command since' -d Title\ string\ to\ be\ used\ for\ output\ formats\ that\ require\ it
487
501
  complete -c doing -l totals -f -n '__fish_doing_using_command since' -d Show\ time\ totals\ at\ the\ end\ of\ output
488
502
  complete -c doing -l val -f -r -n '__fish_doing_using_command since' -d Perform\ a\ tag\ value\ query
489
503
  complete -c doing -l exact -s x -f -n '__fish_doing_using_command since' -d Force\ exact\ search\ string\ matching
@@ -533,10 +547,12 @@ complete -c doing -l from -f -r -n '__fish_doing_using_command today' -d Time\
533
547
  complete -c doing -l output -s o -f -r -n '__fish_doing_using_command today' -d Output\ to\ export\ format
534
548
  complete -c doing -l only_timed -f -n '__fish_doing_using_command today' -d Only\ show\ items\ with\ recorded\ time\ intervals
535
549
  complete -c doing -l section -s s -f -r -n '__fish_doing_using_command today' -d Specify\ a\ section
550
+ complete -c doing -l save -f -r -n '__fish_doing_using_command today' -d Save\ all\ current\ command\ line\ options\ as\ a\ new\ view
536
551
  complete -c doing -l times -s t -f -n '__fish_doing_using_command today' -d Show\ time\ intervals\ on\ @done\ tasks
537
552
  complete -c doing -l tag_order -f -r -n '__fish_doing_using_command today' -d Tag\ sort\ direction
538
553
  complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command today' -d Sort\ tags\ by
539
554
  complete -c doing -l template -f -r -n '__fish_doing_using_command today' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
555
+ complete -c doing -l title -f -r -n '__fish_doing_using_command today' -d Title\ string\ to\ be\ used\ for\ output\ formats\ that\ require\ it
540
556
  complete -c doing -l totals -f -n '__fish_doing_using_command today' -d Show\ time\ totals\ at\ the\ end\ of\ output
541
557
  complete -c doing -l file -s f -f -r -n '__fish_doing_using_command undo' -d Specify\ alternate\ doing\ file
542
558
  complete -c doing -l interactive -s i -f -n '__fish_doing_using_command undo' -d Select\ from\ recent\ backups
@@ -549,6 +565,7 @@ complete -c doing -l bool -f -r -n '__fish_doing_using_command view' -d Boolean
549
565
  complete -c doing -l count -s c -f -r -n '__fish_doing_using_command view' -d Count\ to\ display
550
566
  complete -c doing -l case -f -r -n '__fish_doing_using_command view' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
551
567
  complete -c doing -l color -f -n '__fish_doing_using_command view' -d Include\ colors\ in\ output
568
+ complete -c doing -l config_template -f -r -n '__fish_doing_using_command view' -d Output\ using\ a\ template\ from\ configuration
552
569
  complete -c doing -l duration -f -n '__fish_doing_using_command view' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
553
570
  complete -c doing -l from -f -r -n '__fish_doing_using_command view' -d Date\ range
554
571
  complete -c doing -l hilite -s h -f -n '__fish_doing_using_command view' -d Highlight\ search\ matches\ in\ output
@@ -562,10 +579,14 @@ complete -c doing -l times -s t -f -n '__fish_doing_using_command view' -d Show
562
579
  complete -c doing -l tag -f -r -n '__fish_doing_using_command view' -d Filter\ entries\ by\ tag
563
580
  complete -c doing -l tag_order -f -r -n '__fish_doing_using_command view' -d Tag\ sort\ direction
564
581
  complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command view' -d Sort\ tags\ by
582
+ complete -c doing -l template -f -r -n '__fish_doing_using_command view' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
565
583
  complete -c doing -l totals -f -n '__fish_doing_using_command view' -d Show\ intervals\ with\ totals\ at\ the\ end\ of\ output
566
584
  complete -c doing -l val -f -r -n '__fish_doing_using_command view' -d Perform\ a\ tag\ value\ query
567
585
  complete -c doing -l exact -s x -f -n '__fish_doing_using_command view' -d Force\ exact\ search\ string\ matching
568
586
  complete -c doing -l column -s c -f -n '__fish_doing_using_command views' -d List\ in\ single\ column
587
+ complete -c doing -l editor -s e -f -n '__fish_doing_using_command views' -d Open\ YAML\ for\ view\ in\ editor
588
+ complete -c doing -l output -s o -f -r -n '__fish_doing_using_command views' -d Output/edit\ view\ in\ alternative\ format
589
+ complete -c doing -l remove -s r -f -n '__fish_doing_using_command views' -d Delete\ view\ config
569
590
  complete -c doing -l after -f -r -n '__fish_doing_using_command wiki' -d Include\ entries\ newer\ than\ date
570
591
  complete -c doing -l bool -s b -f -r -n '__fish_doing_using_command wiki' -d Tag\ boolean
571
592
  complete -c doing -l before -f -r -n '__fish_doing_using_command wiki' -d Include\ entries\ older\ than\ date
@@ -582,12 +603,14 @@ complete -c doing -l from -f -r -n '__fish_doing_using_command yesterday' -d Ti
582
603
  complete -c doing -l output -s o -f -r -n '__fish_doing_using_command yesterday' -d Output\ to\ export\ format
583
604
  complete -c doing -l only_timed -f -n '__fish_doing_using_command yesterday' -d Only\ show\ items\ with\ recorded\ time\ intervals
584
605
  complete -c doing -l section -s s -f -r -n '__fish_doing_using_command yesterday' -d Specify\ a\ section
606
+ complete -c doing -l save -f -r -n '__fish_doing_using_command yesterday' -d Save\ all\ current\ command\ line\ options\ as\ a\ new\ view
585
607
  complete -c doing -l times -s t -f -n '__fish_doing_using_command yesterday' -d Show\ time\ intervals\ on\ @done\ tasks
586
608
  complete -c doing -l tag_order -f -r -n '__fish_doing_using_command yesterday' -d Tag\ sort\ direction
587
609
  complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command yesterday' -d Sort\ tags\ by
588
610
  complete -c doing -l template -f -r -n '__fish_doing_using_command yesterday' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
611
+ complete -c doing -l title -f -r -n '__fish_doing_using_command yesterday' -d Title\ string\ to\ be\ used\ for\ output\ formats\ that\ require\ it
589
612
  complete -c doing -l totals -f -n '__fish_doing_using_command yesterday' -d Show\ time\ totals\ at\ the\ end\ of\ output
590
- complete -f -c doing -s o -l output -x -n '__fish_doing_using_command grep search last on recent select show since today view yesterday' -a '(__fish_doing_export_plugin)'
613
+ complete -f -c doing -s o -l output -x -n '__fish_doing_using_command grep search last on recent select show since today view views yesterday' -a '(__fish_doing_export_plugin)'
591
614
  complete -f -c doing -s b -l bool -x -n '__fish_doing_using_command again resume archive move autotag cancel finish grep search last mark flag note on reset begin rotate show since tag tags view wiki' -a 'and or not pattern'
592
615
  complete -f -c doing -l case -x -n '__fish_doing_using_command again resume archive move cancel finish grep search import last mark flag note on reset begin rotate select show since tag tags view' -a 'case-sensitive ignore smart'
593
616
  complete -f -c doing -l sort -x -n '__fish_doing_using_command changes changelog show tags' -a 'asc desc'
@@ -3,14 +3,24 @@
3
3
  ##
4
4
  ## Add presets of flags and switches to a command.
5
5
  ##
6
+ ## :output_template => --output, --config_template, --template
7
+ ##
6
8
  ## :add_entry => --noauto, --note, --ask, --editor, --back
7
9
  ##
10
+ ## :finish_entry => --at/finished, --from, --took
11
+ ##
12
+ ## :time_display => --times, --duration, --totals, --tag_sort, --tag_order, --only_timed
13
+ ##
8
14
  ## :search => --search, --case, --exact
9
15
  ##
10
16
  ## :tag_filter => --tag, --bool, --not, --val
11
17
  ##
18
+ ## :time_filter => --before, --after, --from
19
+ ##
12
20
  ## :date_filter => --before, --after, --from
13
21
  ##
22
+ ## :save => --save
23
+ ##
14
24
  ## @param type [Symbol] The type
15
25
  ## @param cmd The GLI command to which the options will be added
16
26
  ##
@@ -33,12 +43,24 @@ def add_options(type, cmd, default_template: 'default')
33
43
  when :output_template
34
44
  cmd.desc "Output to export format (#{Doing::Plugins.plugin_names(type: :export)})"
35
45
  cmd.arg_name 'FORMAT'
36
- cmd.flag %i[o output]
46
+ cmd.flag %i[o output], type: ExportTemplate
37
47
 
38
48
  cmd.desc "Output using a template from configuration"
39
49
  cmd.arg_name 'TEMPLATE_KEY'
40
50
  cmd.flag [:config_template], type: TemplateName, default_value: default_template
41
51
 
52
+ cmd.desc 'Override output format with a template string containing %placeholders'
53
+ cmd.arg_name 'TEMPLATE_STRING'
54
+ cmd.flag [:template]
55
+ when :output_template_no_defaults
56
+ cmd.desc "Output to export format (#{Doing::Plugins.plugin_names(type: :export)})"
57
+ cmd.arg_name 'FORMAT'
58
+ cmd.flag %i[o output]
59
+
60
+ cmd.desc "Output using a template from configuration"
61
+ cmd.arg_name 'TEMPLATE_KEY'
62
+ cmd.flag [:config_template], type: TemplateName
63
+
42
64
  cmd.desc 'Override output format with a template string containing %placeholders'
43
65
  cmd.arg_name 'TEMPLATE_STRING'
44
66
  cmd.flag [:template]
@@ -130,6 +152,23 @@ def add_options(type, cmd, default_template: 'default')
130
152
  cmd.flag [:bool], must_match: REGEX_BOOL,
131
153
  default_value: :pattern,
132
154
  type: BooleanSymbol
155
+ when :tag_filter_no_defaults
156
+ cmd.desc 'Filter entries by tag. Combine multiple tags with a comma. Wildcards allowed (*, ?)'
157
+ cmd.arg_name 'TAG'
158
+ cmd.flag [:tag], type: TagArray
159
+
160
+ cmd.desc 'Perform a tag value query ("@done > two hours ago" or "@progress < 50").
161
+ May be used multiple times, combined with --bool'
162
+ cmd.arg_name 'QUERY'
163
+ cmd.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY
164
+
165
+ cmd.desc "#{action} items that *don't* match search/tag filters"
166
+ cmd.switch [:not], negatable: false
167
+
168
+ cmd.desc 'Boolean used to combine multiple tags. Use PATTERN to parse + and - as booleans'
169
+ cmd.arg_name 'BOOLEAN'
170
+ cmd.flag [:bool], must_match: REGEX_BOOL,
171
+ type: BooleanSymbol
133
172
  when :time_filter
134
173
  cmd.desc 'View entries before specified time (e.g. 8am, 12:30pm, 15:00)'
135
174
  cmd.arg_name 'TIME_STRING'
@@ -178,5 +217,13 @@ def add_options(type, cmd, default_template: 'default')
178
217
  end
179
218
  cmd.arg_name 'DATE_OR_RANGE'
180
219
  cmd.flag [:from], type: DateRangeString
220
+ when :save
221
+ cmd.desc 'Save all current command line options as a new view'
222
+ cmd.arg_name 'VIEW_NAME'
223
+ cmd.flag %i[save], type: String
224
+
225
+ cmd.desc 'Title string to be used for output formats that require it'
226
+ cmd.arg_name 'TITLE'
227
+ cmd.flag %i[title], type: String
181
228
  end
182
229
  end
@@ -2,11 +2,13 @@
2
2
 
3
3
  require_relative 'tags'
4
4
  require_relative 'nested_hash'
5
+ require_relative 'cleanup'
5
6
 
6
7
  module Doing
7
8
  class ::Array
8
9
  include ArrayTags
9
10
  include ArrayNestedHash
11
+ include ArrayCleanup
10
12
  ##
11
13
  ## Force UTF-8 encoding of strings in array
12
14
  ##
@@ -0,0 +1,31 @@
1
+ module Doing
2
+ module ArrayCleanup
3
+ ##
4
+ ## Like Array#compact -- removes nil items, but also
5
+ ## removes empty strings, zero or negative numbers and FalseClass items
6
+ ##
7
+ ## @return [Array] Array without "bad" elements
8
+ ##
9
+ def remove_bad
10
+ compact.map { |x| x.is_a?(String) ? x.strip : x }.select(&:good?)
11
+ end
12
+
13
+ def remove_bad!
14
+ replace remove_empty
15
+ end
16
+
17
+ ##
18
+ ## Like Array#compact -- removes nil items, but also
19
+ ## removes empty elements
20
+ ##
21
+ ## @return [Array] Array without empty elements
22
+ ##
23
+ def remove_empty
24
+ compact.map { |x| x.is_a?(String) ? x.strip : x }.reject { |x| x.is_a?(String) ? x.empty? : false }
25
+ end
26
+
27
+ def remove_empty!
28
+ replace remove_empty
29
+ end
30
+ end
31
+ end
@@ -7,9 +7,13 @@ module Doing
7
7
 
8
8
  attr_accessor :entries, :change_date
9
9
 
10
- def initialize(version, content)
10
+ attr_writer :prefix
11
+
12
+ def initialize(version, content, prefix: false, only: %i[changed new improved fixed])
11
13
  @version = Version.new(version)
12
14
  @content = content
15
+ @prefix = prefix
16
+ @only = only
13
17
  parse_entries
14
18
  end
15
19
 
@@ -18,10 +22,10 @@ module Doing
18
22
  @change_date = Time.parse(date[0]) if date
19
23
 
20
24
  @entries = []
21
- types = @content.scan(/(?<=\n|\A)#### (NEW|IMPROVED|FIXED)(.*?)(?=\n####|\Z)/m)
25
+ types = @content.scan(/(?<=\n|\A)#### (CHANGED|NEW|IMPROVED|FIXED)(.*?)(?=\n####|\Z)/m)
22
26
  types.each do |type|
23
27
  type[1].scan(/\s*- +(.*?)$/).each do |entry|
24
- @entries << Entry.new(entry[0].strip, type[0])
28
+ @entries << Entry.new(entry[0].strip, type[0], prefix: @prefix)
25
29
  end
26
30
  end
27
31
  end
@@ -57,7 +61,7 @@ module Doing
57
61
  end
58
62
 
59
63
  def split_items
60
- items = { new: [], improved: [], fixed: [], other: [] }
64
+ items = { changed: [], new: [], improved: [], fixed: [], other: [] }
61
65
 
62
66
  @entries.each do |e|
63
67
  type = e.type.downcase.to_sym
@@ -76,6 +80,8 @@ module Doing
76
80
  out = ["### __#{@version}__#{date}"]
77
81
 
78
82
  split_items.each do |type, members|
83
+ next unless @only.include?(type)
84
+
79
85
  if members.count.positive?
80
86
  out << "#### #{type.to_s.capitalize}"
81
87
  out << members.map(&:to_s).join("\n")
@@ -88,7 +94,9 @@ module Doing
88
94
  def changes_only
89
95
  out = []
90
96
 
91
- split_items.each do |_, members|
97
+ split_items.each do |type, members|
98
+ next unless @only.include?(type)
99
+
92
100
  out << members.map(&:to_s).join("\n")
93
101
  end
94
102
 
@@ -6,8 +6,10 @@ module Doing
6
6
  attr_reader :changes
7
7
  attr_writer :changes_only
8
8
 
9
- def initialize(lookup: nil, search: nil, changes: false, sort: :desc)
9
+ def initialize(lookup: nil, search: nil, changes: false, sort: :desc, prefix: false, only: %i[changed new improved fixed])
10
10
  @changes_only = changes
11
+ @prefix = prefix
12
+ @only = only
11
13
  changelog = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'CHANGELOG.md'))
12
14
  raise 'Error locating changelog' unless File.exist?(changelog)
13
15
 
@@ -56,9 +58,10 @@ module Doing
56
58
  @changes = @content.scan(change_rx).each_with_object([]) do |m, a|
57
59
  next if m[0].nil? || m[1].nil?
58
60
 
59
- a << Change.new(m[0], m[1].strip)
61
+ a << Change.new(m[0], m[1].strip, prefix: @prefix)
60
62
  end
61
63
 
64
+ select_type
62
65
  lookup(lookup) unless lookup.nil?
63
66
  search(search) unless search.nil?
64
67
  end
@@ -98,5 +101,11 @@ module Doing
98
101
 
99
102
  @changes.delete_if { |c| c.nil? || c.entries.nil? }
100
103
  end
104
+
105
+ def select_type
106
+ @changes.map do |c|
107
+ c.entries.delete_if { |e| !@only.include?(e.type.normalize_change_type) }
108
+ end
109
+ end
101
110
  end
102
111
  end
@@ -5,17 +5,24 @@ module Doing
5
5
  class Entry
6
6
  attr_reader :type, :string
7
7
 
8
- def initialize(string, type)
8
+ attr_writer :prefix
9
+
10
+ def initialize(string, type, prefix: false)
9
11
  @string = string
10
12
  @type = type
13
+ @prefix = prefix
11
14
  end
12
15
 
13
16
  def clean(string)
14
17
  string.gsub(/\|/, '\|')
15
18
  end
16
19
 
20
+ def print_prefix
21
+ @prefix ? "#{@type}: " : ''
22
+ end
23
+
17
24
  def to_s
18
- "- #{clean(@string)}"
25
+ "- #{print_prefix}#{clean(@string)}"
19
26
  end
20
27
  end
21
28
  end
@@ -23,7 +23,8 @@ module Doing
23
23
  'editors' => {
24
24
  'default' => ENV['DOING_EDITOR'] || ENV['GIT_EDITOR'] || ENV['EDITOR'],
25
25
  'doing_file' => nil,
26
- 'config' => nil
26
+ 'config' => nil,
27
+ 'pager' => nil
27
28
  },
28
29
  'plugins' => {
29
30
  'plugin_path' => File.join(Util.user_home, '.config', 'doing', 'plugins'),
@@ -204,6 +205,7 @@ module Doing
204
205
  real_path = []
205
206
  unless keypath =~ /^[.*]?$/
206
207
  paths = keypath.split(/[:.]/)
208
+ element_count = paths.count
207
209
  while paths.length.positive? && !cfg.nil?
208
210
  path = paths.shift
209
211
  new_cfg = nil
@@ -220,6 +222,8 @@ module Doing
220
222
  end
221
223
 
222
224
  if new_cfg.nil?
225
+ return real_path if real_path[-1] == path && real_path.count == element_count
226
+
223
227
  if distance < 5 && !create
224
228
  return resolve_key_path(keypath, create: false, distance: distance + 1)
225
229
  else
@@ -228,12 +232,12 @@ module Doing
228
232
 
229
233
  resolved = real_path.count.positive? ? "Resolved #{real_path.join('.')}, but " : ''
230
234
  Doing.logger.log_now(:warn, "#{resolved}#{path} is unknown")
231
- new_path = [*real_path, path, *paths].join('.')
235
+ new_path = [*real_path, path, *paths].compact.join('.')
232
236
  Doing.logger.log_now(:warn, "Continuing will create the path #{new_path}")
233
237
  res = Prompt.yn('Key path not found, create it?', default_response: true)
234
238
  raise InvalidArgument, 'Invalid key path' unless res
235
239
 
236
- real_path.push(path).concat(paths)
240
+ real_path.push(path).concat(paths).compact!
237
241
  Doing.logger.debug('Config:', "translated key path #{keypath} to #{real_path.join('.')}")
238
242
  return real_path
239
243
  end
@@ -357,6 +361,27 @@ module Doing
357
361
  config
358
362
  end
359
363
 
364
+ ##
365
+ ## Save a set of options to the `views` configuration
366
+ ##
367
+ ## @param view [Hash] view options
368
+ ## @param title [String] view title
369
+ ##
370
+ def save_view(view, title)
371
+ title.downcase!
372
+ default_template = Doing.setting('templates.default')
373
+ user_config = Util.safe_load_file(config_file)
374
+ user_config['views'] = {} unless user_config.key?('views')
375
+
376
+ view.delete_if { |k, v| v == default_template[k] }
377
+
378
+ user_config['views'][title] = view
379
+ Util.write_to_file(config_file, YAML.dump(user_config), backup: true)
380
+ Doing.logger.warn('Config:', %(View "#{title}" saved to #{config_file}))
381
+ Doing.logger.info('Config:', %(to use, run `doing view #{title}`))
382
+ Hooks.trigger :post_config, self
383
+ end
384
+
360
385
  # @private
361
386
  def inspect
362
387
  %(<Doing::Configuration #{@settings.hash}>)