doing 2.1.89 → 2.1.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/.irbrc +2 -0
  3. data/.rubocop.yml +1 -0
  4. data/.rubocop_todo.yml +251 -0
  5. data/CHANGELOG.md +22 -0
  6. data/Gemfile +2 -0
  7. data/Gemfile.lock +1 -1
  8. data/Rakefile +5 -3
  9. data/bin/commands/changes.rb +3 -1
  10. data/bin/commands/choose.rb +2 -0
  11. data/bin/commands/colors.rb +5 -3
  12. data/bin/commands/commands_accepting.rb +3 -3
  13. data/bin/commands/completion.rb +2 -1
  14. data/bin/commands/config.rb +8 -6
  15. data/bin/commands/done.rb +19 -12
  16. data/bin/commands/finish.rb +4 -2
  17. data/bin/commands/grep.rb +9 -5
  18. data/bin/commands/import.rb +14 -11
  19. data/bin/commands/install_fzf.rb +4 -2
  20. data/bin/commands/last.rb +31 -27
  21. data/bin/commands/meanwhile.rb +6 -2
  22. data/bin/commands/note.rb +6 -3
  23. data/bin/commands/now.rb +2 -0
  24. data/bin/commands/open.rb +6 -1
  25. data/bin/commands/plugins.rb +2 -0
  26. data/bin/commands/recent.rb +47 -33
  27. data/bin/commands/reset.rb +7 -3
  28. data/bin/commands/rotate.rb +6 -3
  29. data/bin/commands/sections.rb +3 -3
  30. data/bin/commands/select.rb +2 -0
  31. data/bin/commands/show.rb +24 -20
  32. data/bin/commands/since.rb +10 -3
  33. data/bin/commands/tag.rb +18 -16
  34. data/bin/commands/tag_dir.rb +5 -2
  35. data/bin/commands/tags.rb +17 -17
  36. data/bin/commands/template.rb +8 -2
  37. data/bin/commands/today.rb +10 -2
  38. data/bin/commands/undo.rb +2 -0
  39. data/bin/commands/update.rb +9 -7
  40. data/bin/commands/view.rb +11 -8
  41. data/bin/commands/views.rb +2 -0
  42. data/bin/commands/yesterday.rb +6 -1
  43. data/bin/doing +54 -57
  44. data/docs/doc/Array.html +3 -3
  45. data/docs/doc/BooleanTermParser/Clause.html +3 -3
  46. data/docs/doc/BooleanTermParser/Operator.html +3 -3
  47. data/docs/doc/BooleanTermParser/Query.html +3 -3
  48. data/docs/doc/BooleanTermParser/QueryParser.html +3 -3
  49. data/docs/doc/BooleanTermParser/QueryTransformer.html +3 -3
  50. data/docs/doc/BooleanTermParser.html +3 -3
  51. data/docs/doc/Doing/ArrayCleanup.html +3 -3
  52. data/docs/doc/Doing/ArrayNestedHash.html +3 -3
  53. data/docs/doc/Doing/ArrayTags.html +9 -9
  54. data/docs/doc/Doing/ByDayExport.html +3 -3
  55. data/docs/doc/Doing/CSVExport.html +4 -4
  56. data/docs/doc/Doing/CalendarImport.html +4 -4
  57. data/docs/doc/Doing/Change.html +3 -3
  58. data/docs/doc/Doing/Changes.html +3 -3
  59. data/docs/doc/Doing/ChronifyArray.html +3 -3
  60. data/docs/doc/Doing/ChronifyNumeric.html +3 -3
  61. data/docs/doc/Doing/ChronifyString.html +6 -6
  62. data/docs/doc/Doing/Color.html +88 -47
  63. data/docs/doc/Doing/Completion/BashCompletions.html +3 -3
  64. data/docs/doc/Doing/Completion/FigCompletions.html +3 -3
  65. data/docs/doc/Doing/Completion/FishCompletions.html +3 -3
  66. data/docs/doc/Doing/Completion/StringUtils.html +3 -3
  67. data/docs/doc/Doing/Completion/ZshCompletions.html +3 -3
  68. data/docs/doc/Doing/Completion.html +5 -5
  69. data/docs/doc/Doing/Configuration.html +6 -6
  70. data/docs/doc/Doing/DayOneRenderer.html +3 -3
  71. data/docs/doc/Doing/DayoneExport.html +4 -4
  72. data/docs/doc/Doing/DoingExport.html +5 -5
  73. data/docs/doc/Doing/DoingImport.html +4 -4
  74. data/docs/doc/Doing/Entry.html +3 -3
  75. data/docs/doc/Doing/Errors/DoingNoTraceError.html +3 -3
  76. data/docs/doc/Doing/Errors/DoingRuntimeError.html +3 -3
  77. data/docs/doc/Doing/Errors/DoingStandardError.html +3 -3
  78. data/docs/doc/Doing/Errors/EmptyInput.html +3 -3
  79. data/docs/doc/Doing/Errors/HistoryLimitError.html +3 -3
  80. data/docs/doc/Doing/Errors/InvalidPlugin.html +3 -3
  81. data/docs/doc/Doing/Errors/MissingBackupFile.html +3 -3
  82. data/docs/doc/Doing/Errors/NoResults.html +3 -3
  83. data/docs/doc/Doing/Errors/PluginException.html +3 -3
  84. data/docs/doc/Doing/Errors/UserCancelled.html +3 -3
  85. data/docs/doc/Doing/Errors/WrongCommand.html +3 -3
  86. data/docs/doc/Doing/Errors.html +3 -3
  87. data/docs/doc/Doing/HTMLExport.html +4 -4
  88. data/docs/doc/Doing/Hooks.html +3 -16
  89. data/docs/doc/Doing/Item.html +4 -4
  90. data/docs/doc/Doing/ItemDates.html +3 -3
  91. data/docs/doc/Doing/ItemQuery.html +3 -3
  92. data/docs/doc/Doing/ItemState.html +3 -3
  93. data/docs/doc/Doing/ItemTags.html +3 -3
  94. data/docs/doc/Doing/Items.html +3 -3
  95. data/docs/doc/Doing/JSONExport.html +4 -4
  96. data/docs/doc/Doing/JSONImport.html +4 -4
  97. data/docs/doc/Doing/Logger.html +183 -3
  98. data/docs/doc/Doing/MarkdownExport.html +4 -4
  99. data/docs/doc/Doing/Note.html +3 -3
  100. data/docs/doc/Doing/Pager.html +54 -58
  101. data/docs/doc/Doing/Plugins.html +3 -3
  102. data/docs/doc/Doing/Prompt.html +4 -4
  103. data/docs/doc/Doing/PromptChoose.html +3 -3
  104. data/docs/doc/Doing/PromptFZF.html +3 -3
  105. data/docs/doc/Doing/PromptInput.html +3 -3
  106. data/docs/doc/Doing/PromptSTD.html +3 -3
  107. data/docs/doc/Doing/PromptYN.html +3 -3
  108. data/docs/doc/Doing/Section.html +3 -3
  109. data/docs/doc/Doing/StringHighlight.html +3 -3
  110. data/docs/doc/Doing/StringNormalize.html +3 -3
  111. data/docs/doc/Doing/StringQuery.html +4 -4
  112. data/docs/doc/Doing/StringTags.html +3 -3
  113. data/docs/doc/Doing/StringTransform.html +3 -3
  114. data/docs/doc/Doing/StringTruncate.html +3 -3
  115. data/docs/doc/Doing/StringURL.html +3 -3
  116. data/docs/doc/Doing/SymbolNormalize.html +5 -5
  117. data/docs/doc/Doing/TaskPaperExport.html +4 -4
  118. data/docs/doc/Doing/TemplateExport.html +5 -5
  119. data/docs/doc/Doing/TemplateString.html +7 -7
  120. data/docs/doc/Doing/TimingImport.html +4 -4
  121. data/docs/doc/Doing/Types.html +3 -3
  122. data/docs/doc/Doing/Util/Backup.html +4 -17
  123. data/docs/doc/Doing/Util.html +56 -61
  124. data/docs/doc/Doing/Version.html +3 -3
  125. data/docs/doc/Doing/WWID.html +6 -4
  126. data/docs/doc/Doing.html +4 -4
  127. data/docs/doc/FalseClass.html +3 -3
  128. data/docs/doc/GLI/Commands/Help.html +5 -5
  129. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +3 -3
  130. data/docs/doc/GLI/Commands.html +3 -3
  131. data/docs/doc/GLI.html +3 -3
  132. data/docs/doc/Hash.html +4 -4
  133. data/docs/doc/Numeric.html +3 -3
  134. data/docs/doc/Object.html +3 -3
  135. data/docs/doc/PhraseParser/Operator.html +3 -3
  136. data/docs/doc/PhraseParser/PhraseClause.html +3 -3
  137. data/docs/doc/PhraseParser/Query.html +3 -3
  138. data/docs/doc/PhraseParser/QueryParser.html +3 -3
  139. data/docs/doc/PhraseParser/QueryTransformer.html +3 -3
  140. data/docs/doc/PhraseParser/TermClause.html +3 -3
  141. data/docs/doc/PhraseParser.html +3 -3
  142. data/docs/doc/Status.html +3 -3
  143. data/docs/doc/String.html +51 -5
  144. data/docs/doc/Symbol.html +3 -3
  145. data/docs/doc/Time.html +3 -3
  146. data/docs/doc/TrueClass.html +3 -3
  147. data/docs/doc/_index.html +4 -4
  148. data/docs/doc/class_list.html +6 -3
  149. data/docs/doc/css/full_list.css +3 -3
  150. data/docs/doc/css/style.css +6 -0
  151. data/docs/doc/file.README.html +3 -3
  152. data/docs/doc/file_list.html +5 -2
  153. data/docs/doc/frames.html +1 -1
  154. data/docs/doc/index.html +3 -3
  155. data/docs/doc/js/app.js +294 -264
  156. data/docs/doc/js/full_list.js +30 -4
  157. data/docs/doc/method_list.html +443 -392
  158. data/docs/doc/top-level-namespace.html +3 -3
  159. data/doing.gemspec +2 -0
  160. data/doing.rdoc +1 -1
  161. data/example_plugin.rb +1 -4
  162. data/lib/doing/add_options.rb +2 -2
  163. data/lib/doing/array/cleanup.rb +2 -0
  164. data/lib/doing/array/nested_hash.rb +2 -0
  165. data/lib/doing/boolean_term_parser.rb +3 -3
  166. data/lib/doing/changelog/changes.rb +4 -5
  167. data/lib/doing/changelog/version.rb +8 -11
  168. data/lib/doing/chronify/array.rb +4 -4
  169. data/lib/doing/chronify/string.rb +5 -4
  170. data/lib/doing/cli_status.rb +7 -2
  171. data/lib/doing/colors.rb +93 -51
  172. data/lib/doing/completion/bash_completion.rb +36 -39
  173. data/lib/doing/completion/completion_string.rb +2 -1
  174. data/lib/doing/completion/fig_completion.rb +33 -33
  175. data/lib/doing/completion/fish_completion.rb +22 -23
  176. data/lib/doing/completion/zsh_completion.rb +5 -5
  177. data/lib/doing/completion.rb +7 -4
  178. data/lib/doing/configuration.rb +21 -13
  179. data/lib/doing/errors.rb +1 -4
  180. data/lib/doing/good.rb +1 -1
  181. data/lib/doing/hash.rb +4 -4
  182. data/lib/doing/help_monkey_patch.rb +1 -1
  183. data/lib/doing/hooks.rb +6 -2
  184. data/lib/doing/item/dates.rb +3 -1
  185. data/lib/doing/item/query.rb +10 -10
  186. data/lib/doing/item/state.rb +2 -0
  187. data/lib/doing/logger.rb +113 -45
  188. data/lib/doing/markdown_document_listener.rb +25 -25
  189. data/lib/doing/normalize.rb +1 -1
  190. data/lib/doing/pager.rb +73 -29
  191. data/lib/doing/plugin_manager.rb +4 -5
  192. data/lib/doing/plugins/export/byday.rb +1 -1
  193. data/lib/doing/plugins/export/dayone_export.rb +28 -27
  194. data/lib/doing/plugins/export/doing_export.rb +1 -1
  195. data/lib/doing/plugins/export/html_export.rb +3 -3
  196. data/lib/doing/plugins/export/json_export.rb +4 -5
  197. data/lib/doing/plugins/export/markdown_export.rb +10 -2
  198. data/lib/doing/plugins/export/taskpaper_export.rb +1 -0
  199. data/lib/doing/plugins/export/template_export.rb +110 -107
  200. data/lib/doing/plugins/import/calendar_import.rb +1 -1
  201. data/lib/doing/plugins/import/doing_import.rb +2 -2
  202. data/lib/doing/plugins/import/timing_import.rb +3 -3
  203. data/lib/doing/prompt/choose.rb +5 -6
  204. data/lib/doing/prompt/fzf.rb +3 -2
  205. data/lib/doing/prompt/input.rb +7 -6
  206. data/lib/doing/prompt/yn.rb +9 -11
  207. data/lib/doing/string/tags.rb +7 -4
  208. data/lib/doing/string/transform.rb +15 -10
  209. data/lib/doing/string/truncate.rb +1 -0
  210. data/lib/doing/string/url.rb +1 -1
  211. data/lib/doing/template_string.rb +13 -9
  212. data/lib/doing/time.rb +4 -2
  213. data/lib/doing/util.rb +12 -11
  214. data/lib/doing/util_backup.rb +29 -26
  215. data/lib/doing/version.rb +3 -1
  216. data/lib/doing/wwid/display.rb +182 -151
  217. data/lib/doing/wwid/editor.rb +13 -12
  218. data/lib/doing/wwid/filetools.rb +13 -11
  219. data/lib/doing/wwid/filter.rb +41 -40
  220. data/lib/doing/wwid/guess.rb +6 -8
  221. data/lib/doing/wwid/interactive.rb +9 -9
  222. data/lib/doing/wwid/modify.rb +53 -53
  223. data/lib/doing/wwid/timers.rb +4 -5
  224. data/lib/doing/wwid/wwid.rb +0 -0
  225. data/lib/doing/wwid/wwidutil.rb +8 -10
  226. data/lib/examples/commands/wiki.rb +2 -0
  227. data/lib/examples/plugins/capture_thing_import.rb +1 -1
  228. data/lib/examples/plugins/say_export.rb +1 -2
  229. data/lib/examples/plugins/wiki_export/wiki_export.rb +3 -4
  230. data/lib/helpers/fzf/test/test_go.rb +5 -5
  231. data/lib/helpers/threaded_tests.rb +20 -20
  232. data/lib/helpers/threaded_tests_string.rb +2 -0
  233. data/rdoc_to_mmd.rb +5 -4
  234. data/rdocfixer.rb +1 -2
  235. data/scripts/deploy.rb +3 -4
  236. data/scripts/generate_bash_completions.rb +40 -43
  237. data/scripts/generate_fish_completions.rb +17 -15
  238. data/scripts/generate_zsh_completions.rb +9 -7
  239. data/scripts/setting_replace.rb +1 -0
  240. data/scripts/sort_commands.rb +4 -2
  241. data/yard_templates/default/method_details/setup.rb +3 -1
  242. metadata +3 -1
data/bin/commands/last.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@last
2
4
  desc 'Show the last entry, optionally edit'
3
5
  long_desc 'Shows the last entry. Using --search and --tag filters, you can view/edit the last entry matching a filter,
@@ -6,10 +8,12 @@ command :last do |c|
6
8
  c.example 'doing last', desc: 'Show the most recent entry in all sections'
7
9
  c.example 'doing last -s Later', desc: 'Show the most recent entry in the Later section'
8
10
  c.example 'doing last --tag project1,work --bool AND', desc: 'Show most recent entry tagged @project1 and @work'
9
- c.example 'doing last --search "side hustle"', desc: 'Show most recent entry containing "side hustle" (fuzzy matching)'
11
+ c.example 'doing last --search "side hustle"',
12
+ desc: 'Show most recent entry containing "side hustle" (fuzzy matching)'
10
13
  c.example 'doing last --search "\'side hustle"', desc: 'Show most recent entry containing "side hustle" (exact match)'
11
14
  c.example 'doing last --edit', desc: 'Open the most recent entry in an editor for modifications'
12
- c.example 'doing last --search "\'side hustle" --edit', desc: 'Open most recent entry containing "side hustle" (exact match) in editor'
15
+ c.example 'doing last --search "\'side hustle" --edit',
16
+ desc: 'Open most recent entry containing "side hustle" (exact match) in editor'
13
17
 
14
18
  c.desc 'Specify a section'
15
19
  c.arg_name 'NAME'
@@ -18,10 +22,10 @@ command :last do |c|
18
22
  c.desc "Edit entry with #{Doing::Util.default_editor}"
19
23
  c.switch %i[e editor], negatable: false, default_value: false
20
24
 
21
- c.desc "Delete the last entry"
25
+ c.desc 'Delete the last entry'
22
26
  c.switch %i[d delete], negatable: false, default_value: false
23
27
 
24
- c.desc "Highlight search matches in output. Only affects command line output"
28
+ c.desc 'Highlight search matches in output. Only affects command line output'
25
29
  c.switch %i[h hilite], default_value: Doing.settings.dig('search', 'highlight')
26
30
 
27
31
  c.desc 'Show elapsed time if entry is not tagged @done'
@@ -32,7 +36,7 @@ command :last do |c|
32
36
  add_options(:tag_filter, c)
33
37
  add_options(:save, c)
34
38
 
35
- c.action do |global_options, options, _args|
39
+ c.action do |_global_options, options, _args|
36
40
  options[:fuzzy] = false
37
41
  raise InvalidArgument, '--tag and --search can not be used together' if options[:tag] && options[:search]
38
42
 
@@ -42,34 +46,34 @@ command :last do |c|
42
46
 
43
47
  if options[:editor]
44
48
  @wwid.edit_last(section: options[:section],
45
- options: {
46
- search: options[:search],
47
- fuzzy: options[:fuzzy],
48
- case: options[:case],
49
- tag: options[:tag],
50
- tag_bool: options[:bool],
51
- not: options[:not],
52
- val: options[:val],
53
- bool: options[:bool]
54
- })
55
- else
56
- last = @wwid.last(times: true, section: options[:section],
57
- options: {
58
- config_template: options[:config_template],
59
- template: options[:template],
60
- duration: options[:duration],
49
+ options: {
61
50
  search: options[:search],
62
51
  fuzzy: options[:fuzzy],
63
52
  case: options[:case],
64
- hilite: options[:hilite],
65
- negate: options[:not],
66
- output: options[:output],
67
53
  tag: options[:tag],
68
54
  tag_bool: options[:bool],
69
- delete: options[:delete],
70
- bool: options[:bool],
71
- val: options[:val]
55
+ not: options[:not],
56
+ val: options[:val],
57
+ bool: options[:bool]
72
58
  })
59
+ else
60
+ last = @wwid.last(times: true, section: options[:section],
61
+ options: {
62
+ config_template: options[:config_template],
63
+ template: options[:template],
64
+ duration: options[:duration],
65
+ search: options[:search],
66
+ fuzzy: options[:fuzzy],
67
+ case: options[:case],
68
+ hilite: options[:hilite],
69
+ negate: options[:not],
70
+ output: options[:output],
71
+ tag: options[:tag],
72
+ tag_bool: options[:bool],
73
+ delete: options[:delete],
74
+ bool: options[:bool],
75
+ val: options[:val]
76
+ })
73
77
  Doing::Pager.page last.strip if last
74
78
  Doing.config.save_view(options.to_view, options[:save].downcase) if options[:save]
75
79
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@meanwhile
2
4
  desc 'Finish any running @meanwhile tasks and optionally create a new one'
3
5
  long_desc 'The @meanwhile tag allows you to have long-running entries that encompass smaller entries.
@@ -6,10 +8,12 @@ big project` to start a @meanwhile entry, add other entries as you work on the p
6
8
  itself to mark the entry as @done.'
7
9
  arg_name 'ENTRY', optional: true
8
10
  command :meanwhile do |c|
9
- c.example 'doing meanwhile "Long task that will have others after it before it\'s done"', desc: 'Add a new long-running entry, completing any current @meanwhile entry'
11
+ c.example 'doing meanwhile "Long task that will have others after it before it\'s done"',
12
+ desc: 'Add a new long-running entry, completing any current @meanwhile entry'
10
13
  c.example 'doing meanwhile', desc: 'Finish any open @meanwhile entry'
11
14
  c.example 'doing meanwhile --archive', desc: 'Finish any open @meanwhile entry and archive it'
12
- c.example 'doing meanwhile --back 2h "Something I\'ve been working on for a while', desc: 'Add a @meanwhile entry with a start date 2 hours ago'
15
+ c.example 'doing meanwhile --back 2h "Something I\'ve been working on for a while',
16
+ desc: 'Add a @meanwhile entry with a start date 2 hours ago'
13
17
 
14
18
  c.desc 'Section'
15
19
  c.arg_name 'NAME'
data/bin/commands/note.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@note
2
4
  desc 'Add a note to the last entry'
3
5
  long_desc %(
@@ -12,7 +14,8 @@ command :note do |c|
12
14
  c.example 'doing note', desc: 'Open the last entry in $EDITOR to append a note'
13
15
  c.example 'doing note "Just a quick annotation"', desc: 'Add a quick note to the last entry'
14
16
  c.example 'doing note --tag done "Keeping it real or something"', desc: 'Add a note to the last item tagged @done'
15
- c.example 'doing note --search "late night" -e', desc: 'Open $EDITOR to add a note to the last item containing "late night" (fuzzy matched)'
17
+ c.example 'doing note --search "late night" -e',
18
+ desc: 'Open $EDITOR to add a note to the last item containing "late night" (fuzzy matched)'
16
19
 
17
20
  c.desc 'Section'
18
21
  c.arg_name 'NAME'
@@ -71,8 +74,8 @@ command :note do |c|
71
74
  end
72
75
 
73
76
  if (new_note.empty? && !options[:remove]) || options[:ask]
74
- $stderr.puts last_note if last_note.good?
75
- $stderr.puts new_note if new_note.good?
77
+ warn last_note if last_note.good?
78
+ warn new_note if new_note.good?
76
79
  new_note.add(Doing::Prompt.read_lines(prompt: 'Add a note'))
77
80
  end
78
81
 
data/bin/commands/now.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@now @@next
2
4
 
3
5
  module Doing
data/bin/commands/open.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@open
2
4
  desc 'Open the "doing" file in an editor'
3
5
  long_desc "`doing open` defaults to using the editors.doing_file setting
@@ -25,7 +27,10 @@ command :open do |c|
25
27
  end
26
28
 
27
29
  if options[:editor]
28
- raise MissingEditor, "Editor #{options[:editor]} not found" unless Doing::Util.exec_available(options[:editor].split(/ /).first)
30
+ unless Doing::Util.exec_available(options[:editor].split(/ /).first)
31
+ raise MissingEditor,
32
+ "Editor #{options[:editor]} not found"
33
+ end
29
34
 
30
35
  editor = TTY::Which.which(options[:editor])
31
36
  system %(#{editor} "#{File.expand_path(@wwid.doing_file)}")
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@plugins
2
4
  desc 'List installed plugins'
3
5
  long_desc %(Lists available plugins, including user-installed plugins.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@recent
2
4
  desc 'List recent entries'
3
5
  default_value 10
@@ -21,39 +23,51 @@ command :recent do |c|
21
23
  add_options(:save, c)
22
24
 
23
25
  c.action do |global_options, options, args|
24
- section = @wwid.guess_section(options[:section]) || options[:section].cap_first
25
-
26
- unless global_options[:version]
27
- config_count = if Doing.setting('templates.recent.count')
28
- Doing.setting('templates.recent.count').to_i
29
- else
30
- 10
31
- end
32
-
33
- count = args.empty? ? config_count : args[0].to_i
34
-
35
- options[:times] = true if options[:totals]
36
- options[:sort_tags] = options[:tag_sort]
37
-
38
- template = Doing.setting('templates.recent').deep_merge(Doing.setting('templates.default'))
39
- tags_color = template.key?('tags_color') ? template['tags_color'] : nil
40
-
41
- opts = {
42
- config_template: options[:config_template],
43
- duration: options[:duration],
44
- interactive: options[:interactive],
45
- output: options[:output],
46
- sort_tags: options[:sort_tags],
47
- tags_color: tags_color,
48
- template: options[:template],
49
- times: options[:times],
50
- totals: options[:totals]
51
- }
52
-
53
- Doing::Pager.page @wwid.recent(count, section.cap_first, opts)
54
- opts[:count] = count
55
- opts[:title] = options[:title]
56
- Doing.config.save_view(opts.to_view, options[:save].downcase) if options[:save]
26
+ Doing.logger.measure(:recent_command) do
27
+ section = @wwid.guess_section(options[:section]) || options[:section].cap_first
28
+
29
+ unless global_options[:version]
30
+ count = nil
31
+ opts = nil
32
+
33
+ Doing.logger.measure(:recent_config) do
34
+ config_count = if Doing.setting('templates.recent.count')
35
+ Doing.setting('templates.recent.count').to_i
36
+ else
37
+ 10
38
+ end
39
+
40
+ count = args.empty? ? config_count : args[0].to_i
41
+
42
+ options[:times] = true if options[:totals]
43
+ options[:sort_tags] = options[:tag_sort]
44
+
45
+ template = Doing.setting('templates.recent').deep_merge(Doing.setting('templates.default'))
46
+ tags_color = template.key?('tags_color') ? template['tags_color'] : nil
47
+
48
+ opts = {
49
+ config_template: options[:config_template],
50
+ duration: options[:duration],
51
+ interactive: options[:interactive],
52
+ output: options[:output],
53
+ sort_tags: options[:sort_tags],
54
+ tags_color: tags_color,
55
+ template: options[:template],
56
+ times: options[:times],
57
+ totals: options[:totals]
58
+ }
59
+ end
60
+
61
+ Doing.logger.measure(:recent_pager) do
62
+ Doing::Pager.page @wwid.recent(count, section.cap_first, opts)
63
+ end
64
+
65
+ Doing.logger.measure(:recent_save) do
66
+ opts[:count] = count
67
+ opts[:title] = options[:title]
68
+ Doing.config.save_view(opts.to_view, options[:save].downcase) if options[:save]
69
+ end
70
+ end
57
71
  end
58
72
  end
59
73
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@reset @@begin
2
4
  desc 'Reset the start time of an entry'
3
5
  long_desc 'Update the start time of the last entry or the last entry matching a tag/search filter.
@@ -6,9 +8,11 @@ If a date string is provided as an argument, the start time will be set to the p
6
8
  arg_name 'DATE_STRING', optional: true
7
9
  command %i[reset begin] do |c|
8
10
  c.example 'doing reset', desc: 'Reset the start time of the last entry to the current time'
9
- c.example 'doing reset --tag project1', desc: 'Reset the start time of the most recent entry tagged @project1 to the current time'
11
+ c.example 'doing reset --tag project1',
12
+ desc: 'Reset the start time of the most recent entry tagged @project1 to the current time'
10
13
  c.example 'doing reset 3pm', desc: 'Reset the start time of the last entry to 3pm of the current day'
11
- c.example 'doing begin --tag todo --resume', desc: 'alias for reset. Updates the last @todo entry to the current time, removing @done tag.'
14
+ c.example 'doing begin --tag todo --resume',
15
+ desc: 'alias for reset. Updates the last @todo entry to the current time, removing @done tag.'
12
16
 
13
17
  c.desc 'Limit search to section'
14
18
  c.arg_name 'NAME'
@@ -37,7 +41,7 @@ command %i[reset begin] do |c|
37
41
  add_options(:search, c)
38
42
  add_options(:tag_filter, c)
39
43
 
40
- c.action do |global_options, options, args|
44
+ c.action do |_global_options, options, args|
41
45
  if args.count.positive?
42
46
  reset_date = args.join(' ').chronify(guess: :begin)
43
47
  raise InvalidArgument, 'Invalid date string' unless reset_date
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@rotate
2
4
  desc 'Move entries to archive file'
3
5
  long_desc 'As your doing file grows, commands can get slow. Given that your historical data (and your archive section)
@@ -5,8 +7,10 @@ probably aren\'t providing any useful insights a year later, use this command to
5
7
  file. You\'ll still have access to all historical data, but it won\'t be slowing down daily operation.'
6
8
  command :rotate do |c|
7
9
  c.example 'doing rotate', desc: 'Move all entries in doing file to a dated secondary file'
8
- c.example 'doing rotate --section Archive --keep 10', desc: 'Move entries in the Archive section to a secondary file, keeping the most recent 10 entries'
9
- c.example 'doing rotate --tag project1,done --bool AND', desc: 'Move entries tagged @project1 and @done to a secondary file'
10
+ c.example 'doing rotate --section Archive --keep 10',
11
+ desc: 'Move entries in the Archive section to a secondary file, keeping the most recent 10 entries'
12
+ c.example 'doing rotate --tag project1,done --bool AND',
13
+ desc: 'Move entries tagged @project1 and @done to a secondary file'
10
14
 
11
15
  c.desc 'How many items to keep in each section (most recent)'
12
16
  c.arg_name 'X'
@@ -56,4 +60,3 @@ end
56
60
  # @wwid.write(@wwid.doing_file)
57
61
  # end
58
62
  # end
59
-
@@ -51,10 +51,11 @@ command :sections do |c|
51
51
  items = @wwid.content.in_section(section)
52
52
 
53
53
  if items.count.positive?
54
- res = Doing::Prompt.yn("#{options[:archive] ? 'Archive' : 'Delete'} #{items.count} entries from #{section}", default_response: 'n')
54
+ res = Doing::Prompt.yn("#{options[:archive] ? 'Archive' : 'Delete'} #{items.count} entries from #{section}",
55
+ default_response: 'n')
55
56
 
56
57
  if options[:archive] && res
57
- @wwid.archive(section, {keep: 0})
58
+ @wwid.archive(section, { keep: 0 })
58
59
  elsif res
59
60
  items.each { |item| @wwid.content.delete_item(item) }
60
61
  end
@@ -83,4 +84,3 @@ command :add_section do |c|
83
84
  action.call(g, o, a)
84
85
  end
85
86
  end
86
-
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@select
2
4
  desc 'Display an interactive menu to perform operations'
3
5
  long_desc 'List all entries and select with typeahead fuzzy matching.
data/bin/commands/show.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@show
2
4
  desc 'List all entries'
3
5
  long_desc %(
@@ -15,14 +17,16 @@ command :show do |c|
15
17
  c.example 'doing show Later @doing', desc: 'Show entries from the Later section tagged @doing'
16
18
  c.example 'doing show @oracle @writing --bool and', desc: 'Show entries tagged both @oracle and @writing'
17
19
  c.example 'doing show Currently @devo --bool not', desc: 'Show entries in Currently NOT tagged @devo'
18
- c.example 'doing show Ideas @doing --from "mon to fri"', desc: 'Show entries tagged @doing from the Ideas section added between monday and friday of the current week.'
19
- c.example 'doing show --interactive Later @doing', desc: 'Create a menu from entries from the Later section tagged @doing to perform batch actions'
20
+ c.example 'doing show Ideas @doing --from "mon to fri"',
21
+ desc: 'Show entries tagged @doing from the Ideas section added between monday and friday of the current week.'
22
+ c.example 'doing show --interactive Later @doing',
23
+ desc: 'Create a menu from entries from the Later section tagged @doing to perform batch actions'
20
24
 
21
25
  c.desc 'Max count to show'
22
26
  c.arg_name 'MAX'
23
27
  c.flag %i[c count], default_value: 0, must_match: /^\d+$/, type: Integer
24
28
 
25
- c.desc "Highlight search matches in output. Only affects command line output"
29
+ c.desc 'Highlight search matches in output. Only affects command line output'
26
30
  c.switch %i[h hilite], default_value: Doing.settings.dig('search', 'highlight')
27
31
 
28
32
  c.desc "Edit matching entries with #{Doing::Util.default_editor}"
@@ -111,11 +115,11 @@ command :show do |c|
111
115
  options[:times] = true if options[:totals]
112
116
 
113
117
  template = Doing.setting(['templates', options[:config_template]]).deep_merge({
114
- 'wrap_width' => Doing.setting('wrap_width') || 0,
115
- 'date_format' => Doing.setting('default_date_format'),
116
- 'order' => Doing.setting('order')&.normalize_order || :asc,
117
- 'tags_color' => Doing.setting('tags_color')
118
- })
118
+ 'wrap_width' => Doing.setting('wrap_width') || 0,
119
+ 'date_format' => Doing.setting('default_date_format'),
120
+ 'order' => Doing.setting('order')&.normalize_order || :asc,
121
+ 'tags_color' => Doing.setting('tags_color')
122
+ })
119
123
 
120
124
  if options[:search]
121
125
  search = options[:search]
@@ -138,19 +142,19 @@ command :show do |c|
138
142
  items = @wwid.filter_items([], opt: options)
139
143
 
140
144
  if options[:menu]
141
- Doing.logger.benchmark(:menu, :start)
142
- tag = @wwid.choose_tag(section, items: items, include_all: true)
143
- raise UserCancelled unless tag
144
-
145
- tags = tag.split(/ +/).map { |t| t.strip.sub(/^@?/, '') } if tag =~ /^@/
146
- if tags.good?
147
- tag_filter = {
148
- 'tags' => tags,
149
- 'bool' => options[:bool]
150
- }
151
- options[:tag_filter] = tag_filter
145
+ Doing.logger.measure(:menu) do
146
+ tag = @wwid.choose_tag(section, items: items, include_all: true)
147
+ raise UserCancelled unless tag
148
+
149
+ tags = tag.split(/ +/).map { |t| t.strip.sub(/^@?/, '') } if tag =~ /^@/
150
+ if tags.good?
151
+ tag_filter = {
152
+ 'tags' => tags,
153
+ 'bool' => options[:bool]
154
+ }
155
+ options[:tag_filter] = tag_filter
156
+ end
152
157
  end
153
- Doing.logger.benchmark(:menu, :finish)
154
158
  end
155
159
 
156
160
  options[:age] ||= :newest
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @since
2
4
  desc 'List entries since a date'
3
5
  long_desc %(Date argument can be natural language and are always interpreted as being in the past. "thursday" would be interpreted as "last thursday,"
@@ -5,7 +7,8 @@ and "2d" would be interpreted as "two days ago.")
5
7
  arg_name 'DATE_STRING'
6
8
  command :since do |c|
7
9
  c.example 'doing since 7/30', desc: 'List all entries created since 12am on 7/30 of the current year'
8
- c.example 'doing since "monday 3pm" --output json', desc: 'Show entries since 3pm on Monday of the current week, output in JSON format'
10
+ c.example 'doing since "monday 3pm" --output json',
11
+ desc: 'Show entries since 3pm on Monday of the current week, output in JSON format'
9
12
 
10
13
  c.desc 'Section'
11
14
  c.arg_name 'NAME'
@@ -17,7 +20,10 @@ command :since do |c|
17
20
  add_options(:search, c)
18
21
  add_options(:save, c)
19
22
  c.action do |_global_options, options, args|
20
- raise DoingRuntimeError, %(Invalid output type "#{options[:output]}") if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)
23
+ if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)
24
+ raise DoingRuntimeError,
25
+ %(Invalid output type "#{options[:output]}")
26
+ end
21
27
 
22
28
  raise MissingArgument, 'Missing date argument' if args.empty?
23
29
 
@@ -36,7 +42,8 @@ command :since do |c|
36
42
  options[:times] = true if options[:totals]
37
43
  options[:sort_tags] = options[:tag_sort]
38
44
 
39
- Doing::Pager.page @wwid.list_date([start, finish], options[:section], options[:times], options[:output], options).chomp
45
+ Doing::Pager.page @wwid.list_date([start, finish], options[:section], options[:times], options[:output],
46
+ options).chomp
40
47
  if options[:save]
41
48
  options[:after] = Doing.original_options[:date_begin] if Doing.original_options[:date_begin].good?
42
49
  Doing.config.save_view(options.to_view, options[:save].downcase)
data/bin/commands/tag.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@tag
2
4
  desc 'Add tag(s) to last entry'
3
5
  long_desc 'Add (or remove) tags from the last entry, or from multiple entries
@@ -17,9 +19,12 @@ arg_name 'TAG', :multiple
17
19
  command :tag do |c|
18
20
  c.example 'doing tag mytag', desc: 'Add @mytag to the last entry created'
19
21
  c.example 'doing tag --remove mytag', desc: 'Remove @mytag from the last entry created'
20
- c.example 'doing tag --rename "other*" --count 10 newtag', desc: 'Rename tags beginning with "other" (wildcard) to @newtag on the last 10 entries'
21
- c.example 'doing tag --search "developing" coding', desc: 'Add @coding to the last entry containing string "developing" (fuzzy matching)'
22
- c.example 'doing tag --interactive --tag project1 coding', desc: 'Create an interactive menu from entries tagged @project1, selection(s) will be tagged with @coding'
22
+ c.example 'doing tag --rename "other*" --count 10 newtag',
23
+ desc: 'Rename tags beginning with "other" (wildcard) to @newtag on the last 10 entries'
24
+ c.example 'doing tag --search "developing" coding',
25
+ desc: 'Add @coding to the last entry containing string "developing" (fuzzy matching)'
26
+ c.example 'doing tag --interactive --tag project1 coding',
27
+ desc: 'Create an interactive menu from entries tagged @project1, selection(s) will be tagged with @coding'
23
28
 
24
29
  c.desc 'Section'
25
30
  c.arg_name 'SECTION_NAME'
@@ -69,9 +74,7 @@ command :tag do |c|
69
74
 
70
75
  section = 'All'
71
76
 
72
- if options[:section]
73
- section = @wwid.guess_section(options[:section]) || options[:section].cap_first
74
- end
77
+ section = @wwid.guess_section(options[:section]) || options[:section].cap_first if options[:section]
75
78
 
76
79
  search_tags = options[:tag].nil? ? [] : options[:tag]
77
80
 
@@ -112,16 +115,15 @@ command :tag do |c|
112
115
  matches = @wwid.filter_items([], opt: options).count
113
116
 
114
117
  if matches > 5
115
- if options[:search]
116
- section_q = ' matching your search terms'
117
- elsif options[:tag]
118
- section_q = ' matching your tag search'
119
- elsif section == 'All'
120
- section_q = ''
121
- else
122
- section_q = " in section #{section}"
123
- end
124
-
118
+ section_q = if options[:search]
119
+ ' matching your search terms'
120
+ elsif options[:tag]
121
+ ' matching your tag search'
122
+ elsif section == 'All'
123
+ ''
124
+ else
125
+ " in section #{section}"
126
+ end
125
127
 
126
128
  question = if options[:autotag]
127
129
  "Are you sure you want to autotag #{matches} records#{section_q}"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@tag_dir
2
4
  desc 'Set the default tags for the current directory'
3
5
  long_desc 'Adds default_tags to a .doingrc file in the current directory. Any entry created in this directory or its
@@ -5,7 +7,8 @@ subdirectories will be tagged with the default tags. You can modify these any ti
5
7
  manually editing the .doingrc file.'
6
8
  arg_name 'TAG [TAG..]'
7
9
  command :tag_dir do |c|
8
- c.example 'doing tag_dir project1 project2', desc: 'Add @project1 and @project2 to to any entries created from the current directory'
10
+ c.example 'doing tag_dir project1 project2',
11
+ desc: 'Add @project1 and @project2 to to any entries created from the current directory'
9
12
  c.example 'doing tag_dir --clear', desc: 'Clear the default tags for the directory'
10
13
 
11
14
  c.desc 'Remove all default_tags from the local .doingrc'
@@ -20,7 +23,7 @@ command :tag_dir do |c|
20
23
  c.action do |global, options, args|
21
24
  if args.empty? && !options[:clear] && !options[:editor]
22
25
  all_tags = @wwid.content.all_tags
23
- $stderr.puts Doing::Color.boldwhite('Enter tags separated by spaces, tab to complete')
26
+ warn Doing::Color.boldwhite('Enter tags separated by spaces, tab to complete')
24
27
  input = Doing::Prompt.read_line(prompt: "Tags to #{options[:remove] ? 'remove' : 'add'}", completions: all_tags)
25
28
  tags = input.split_tags
26
29
  else
data/bin/commands/tags.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@tags
2
4
  desc 'List all tags in the current Doing file'
3
5
  arg_name 'MAX_COUNT', optional: true, type: Integer
@@ -27,40 +29,38 @@ command :tags do |c|
27
29
  add_options(:tag_filter, c)
28
30
 
29
31
  c.action do |_global, options, args|
30
- section = @wwid.guess_section(options[:section]) || options[:section].cap_first
32
+ @wwid.guess_section(options[:section]) || options[:section].cap_first
31
33
  options[:count] = args.count.positive? ? args[0].to_i : 0
32
34
 
33
35
  items = @wwid.filter_items([], opt: options)
34
36
 
35
37
  if options[:interactive]
36
38
  items = Doing::Prompt.choose_from_items(items, include_section: options[:section].nil?,
37
- menu: true,
38
- header: '',
39
- prompt: 'Select entries to scan > ',
40
- multiple: true,
41
- sort: true,
42
- show_if_single: true)
39
+ menu: true,
40
+ header: '',
41
+ prompt: 'Select entries to scan > ',
42
+ multiple: true,
43
+ sort: true,
44
+ show_if_single: true)
43
45
  end
44
46
 
45
47
  # items = @wwid.content.in_section(section)
46
48
  tags = @wwid.all_tags(items, counts: true)
47
49
 
48
- if options[:sort] =~ /^n/i
49
- tags = tags.sort_by { |tag, count| tag }
50
- else
51
- tags = tags.sort_by { |tag, count| count }
52
- end
50
+ tags = if options[:sort] =~ /^n/i
51
+ tags.sort_by { |tag, _count| tag }
52
+ else
53
+ tags.sort_by { |_tag, count| count }
54
+ end
53
55
 
54
56
  tags.reverse! if options[:order] == :desc
55
57
 
56
58
  if options[:counts]
57
59
  tags.each { |t, c| puts "#{t} (#{c})" }
60
+ elsif options[:line]
61
+ puts tags.map { |t, _c| t }.to_tags.join(' ')
58
62
  else
59
- if options[:line]
60
- puts tags.map { |t, c| t }.to_tags.join(' ')
61
- else
62
- tags.each { |t, c| puts "#{t}" }
63
- end
63
+ tags.each_key { |t| puts t }
64
64
  end
65
65
  end
66
66
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@template
2
4
  desc 'Output HTML, CSS, and Markdown (ERB) templates for customization'
3
5
  long_desc %(
@@ -31,14 +33,18 @@ command :template do |c|
31
33
  else
32
34
 
33
35
  if args.empty?
34
- type = Doing::Prompt.choose_from(Doing::Plugins.plugin_templates, sorted: false, prompt: 'Select template type > ')
36
+ type = Doing::Prompt.choose_from(Doing::Plugins.plugin_templates, sorted: false,
37
+ prompt: 'Select template type > ')
35
38
  type.sub!(/ \(.*?\)$/, '').strip!
36
39
  options[:save] = Doing::Prompt.yn("Save to #{options[:path]}? (No outputs to STDOUT)", default_response: false)
37
40
  else
38
41
  type = args[0]
39
42
  end
40
43
 
41
- raise InvalidPluginType, "No type specified, use `doing template [#{Doing::Plugins.plugin_templates.join('|')}]`" unless type
44
+ unless type
45
+ raise InvalidPluginType,
46
+ "No type specified, use `doing template [#{Doing::Plugins.plugin_templates.join('|')}]`"
47
+ end
42
48
 
43
49
  if options[:save]
44
50
  Doing::Plugins.template_for_trigger(type, save_to: options[:path])