doing 2.1.25 → 2.1.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.yardoc/checksums +4 -4
  3. data/.yardoc/object_types +0 -0
  4. data/.yardoc/objects/root.dat +0 -0
  5. data/CHANGELOG.md +283 -108
  6. data/Gemfile.lock +1 -1
  7. data/README.md +1 -1
  8. data/bin/commands/add_section.rb +13 -0
  9. data/bin/commands/again.rb +99 -0
  10. data/bin/commands/archive.rb +96 -0
  11. data/bin/commands/cancel.rb +102 -0
  12. data/bin/commands/changes.rb +42 -0
  13. data/bin/commands/choose.rb +9 -0
  14. data/bin/commands/colors.rb +19 -0
  15. data/bin/commands/commands.rb +87 -0
  16. data/bin/commands/commands_accepting.rb +25 -0
  17. data/bin/commands/completion.rb +24 -0
  18. data/bin/commands/config.rb +245 -0
  19. data/bin/commands/done.rb +249 -0
  20. data/bin/commands/finish.rb +149 -0
  21. data/bin/commands/flag.rb +126 -0
  22. data/bin/commands/grep.rb +124 -0
  23. data/bin/commands/import.rb +101 -0
  24. data/bin/commands/install_fzf.rb +17 -0
  25. data/bin/commands/last.rb +114 -0
  26. data/bin/commands/meanwhile.rb +86 -0
  27. data/bin/commands/note.rb +130 -0
  28. data/bin/commands/now.rb +151 -0
  29. data/bin/commands/on.rb +66 -0
  30. data/bin/commands/open.rb +53 -0
  31. data/bin/commands/plugins.rb +23 -0
  32. data/bin/commands/recent.rb +78 -0
  33. data/bin/commands/redo.rb +22 -0
  34. data/bin/commands/reset.rb +106 -0
  35. data/bin/commands/rotate.rb +73 -0
  36. data/bin/commands/sections.rb +11 -0
  37. data/bin/commands/select.rb +123 -0
  38. data/bin/commands/show.rb +231 -0
  39. data/bin/commands/since.rb +64 -0
  40. data/bin/commands/tag.rb +179 -0
  41. data/bin/commands/tag_dir.rb +29 -0
  42. data/bin/commands/tags.rb +93 -0
  43. data/bin/commands/template.rb +61 -0
  44. data/bin/commands/today.rb +65 -0
  45. data/bin/commands/undo.rb +49 -0
  46. data/bin/commands/view.rb +238 -0
  47. data/bin/commands/views.rb +11 -0
  48. data/bin/commands/yesterday.rb +73 -0
  49. data/bin/doing +39 -3641
  50. data/docs/doc/Array.html +1 -1
  51. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  52. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  53. data/docs/doc/BooleanTermParser/Query.html +1 -1
  54. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  55. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  56. data/docs/doc/BooleanTermParser.html +1 -1
  57. data/docs/doc/Doing/Color.html +1 -1
  58. data/docs/doc/Doing/Completion.html +1 -1
  59. data/docs/doc/Doing/Configuration.html +2 -1
  60. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  61. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  62. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  63. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  64. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  65. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  66. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  67. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  68. data/docs/doc/Doing/Errors.html +1 -1
  69. data/docs/doc/Doing/Hooks.html +1 -1
  70. data/docs/doc/Doing/Item.html +1 -1
  71. data/docs/doc/Doing/Items.html +1 -1
  72. data/docs/doc/Doing/LogAdapter.html +1 -1
  73. data/docs/doc/Doing/Note.html +1 -1
  74. data/docs/doc/Doing/Pager.html +1 -1
  75. data/docs/doc/Doing/Plugins.html +1 -1
  76. data/docs/doc/Doing/Prompt.html +46 -1
  77. data/docs/doc/Doing/Section.html +1 -1
  78. data/docs/doc/Doing/TemplateString.html +1 -1
  79. data/docs/doc/Doing/Types.html +1 -1
  80. data/docs/doc/Doing/Util/Backup.html +1 -1
  81. data/docs/doc/Doing/Util.html +1 -1
  82. data/docs/doc/Doing/WWID.html +1 -1
  83. data/docs/doc/Doing.html +2 -2
  84. data/docs/doc/FalseClass.html +201 -0
  85. data/docs/doc/GLI/Commands/Help.html +1 -1
  86. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  87. data/docs/doc/GLI/Commands.html +1 -1
  88. data/docs/doc/GLI.html +1 -1
  89. data/docs/doc/Hash.html +1 -1
  90. data/docs/doc/Numeric.html +1 -1
  91. data/docs/doc/Object.html +203 -0
  92. data/docs/doc/PhraseParser/Operator.html +1 -1
  93. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  94. data/docs/doc/PhraseParser/Query.html +1 -1
  95. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  96. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  97. data/docs/doc/PhraseParser/TermClause.html +1 -1
  98. data/docs/doc/PhraseParser.html +1 -1
  99. data/docs/doc/Status.html +1 -1
  100. data/docs/doc/String.html +1 -1
  101. data/docs/doc/Symbol.html +1 -1
  102. data/docs/doc/Time.html +1 -1
  103. data/docs/doc/TrueClass.html +201 -0
  104. data/docs/doc/_index.html +1 -1
  105. data/docs/doc/file.README.html +2 -2
  106. data/docs/doc/index.html +2 -2
  107. data/docs/doc/method_list.html +374 -366
  108. data/docs/doc/top-level-namespace.html +1 -1
  109. data/doing.rdoc +15 -5
  110. data/lib/completion/_doing.zsh +3 -3
  111. data/lib/completion/doing.fish +1 -1
  112. data/lib/doing/changelog/changes.rb +1 -1
  113. data/lib/doing/configuration.rb +1 -0
  114. data/lib/doing/pager.rb +1 -0
  115. data/lib/doing/prompt.rb +8 -0
  116. data/lib/doing/version.rb +1 -1
  117. data/lib/examples/commands/wiki.rb +6 -7
  118. data/lib/helpers/threaded_tests.rb +25 -19
  119. metadata +45 -1
@@ -102,7 +102,7 @@
102
102
  </div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Sun Jan 23 09:24:04 2022 by
105
+ Generated on Sun Jan 23 16:30:43 2022 by
106
106
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
107
  0.9.27 (ruby-3.0.1).
108
108
  </div>
data/doing.rdoc CHANGED
@@ -5,7 +5,7 @@ record of what you've been doing, complete with tag-based time tracking. The
5
5
  command line tool allows you to add entries, annotate with tags and notes, and
6
6
  view your entries with myriad options, with a focus on a "natural" language syntax.
7
7
 
8
- v2.1.25
8
+ v2.1.26
9
9
 
10
10
  === Global Options
11
11
  === --config_file arg
@@ -434,14 +434,24 @@ Display all versions
434
434
 
435
435
 
436
436
 
437
- ==== Command: <tt>choose </tt>
438
- Select a section to display from a menu
439
-
440
-
441
437
  ==== Command: <tt>colors </tt>
442
438
  List available color variables for configuration templates and views
443
439
 
444
440
 
441
+ ==== Command: <tt>commands </tt>
442
+ Enable and disable Doing commands
443
+
444
+
445
+ ===== Commands
446
+ ====== Command: <tt>add|enable COMMAND [COMMAND...]</tt>
447
+ Enable Doing commands
448
+
449
+ Run without arguments to select commands from a list.
450
+ ====== Command: <tt>remove|disable </tt>
451
+ Disable Doing commands
452
+
453
+
454
+ [Default Command] add
445
455
  ==== Command: <tt>completion </tt>
446
456
  Generate shell completion scripts
447
457
 
@@ -16,8 +16,8 @@ function _doing() {
16
16
  'cancel:End last X entries with no time tracked'
17
17
  'changes:List recent changes in Doing'
18
18
  'changelog:List recent changes in Doing'
19
- 'choose:Select a section to display from a menu'
20
19
  'colors:List available color variables for configuration templates and views'
20
+ 'commands:Enable and disable Doing commands'
21
21
  'completion:Generate shell completion scripts'
22
22
  'config:Edit the configuration file or output a value from it'
23
23
  'done:Add a completed item with @done(date)'
@@ -93,10 +93,10 @@ function _doing() {
93
93
  changelog)
94
94
  args=( {-a,--all}"[Display all versions]" {-l,--lookup=}"[Look up a specific version]" {-s,--search=}"[Show changelogs matching search terms]" )
95
95
  ;;
96
- choose)
96
+ colors)
97
97
  args=( )
98
98
  ;;
99
- colors)
99
+ commands)
100
100
  args=( )
101
101
  ;;
102
102
  completion)
@@ -141,8 +141,8 @@ complete -xc doing -n '__fish_doing_needs_command' -a 'archive move' -d Move\ en
141
141
  complete -xc doing -n '__fish_doing_needs_command' -a 'autotag' -d Autotag\ last\ entry\ or\ filtered\ entries
142
142
  complete -xc doing -n '__fish_doing_needs_command' -a 'cancel' -d End\ last\ X\ entries\ with\ no\ time\ tracked
143
143
  complete -xc doing -n '__fish_doing_needs_command' -a 'changes changelog' -d List\ recent\ changes\ in\ Doing
144
- complete -xc doing -n '__fish_doing_needs_command' -a 'choose' -d Select\ a\ section\ to\ display\ from\ a\ menu
145
144
  complete -xc doing -n '__fish_doing_needs_command' -a 'colors' -d List\ available\ color\ variables\ for\ configuration\ templates\ and\ views
145
+ complete -xc doing -n '__fish_doing_needs_command' -a 'commands' -d Enable\ and\ disable\ Doing\ commands
146
146
  complete -xc doing -n '__fish_doing_needs_command' -a 'completion' -d Generate\ shell\ completion\ scripts
147
147
  complete -xc doing -n '__fish_doing_needs_command' -a 'config' -d Edit\ the\ configuration\ file\ or\ output\ a\ value\ from\ it
148
148
  complete -xc doing -n '__fish_doing_needs_command' -a 'done did' -d Add\ a\ completed\ item\ with\ @done\(date\)
@@ -24,7 +24,7 @@ module Doing
24
24
  private
25
25
 
26
26
  def parse_changes(lookup, search)
27
- change_rx = /(?<=\n|\A)### (\d+\.\d+\.\d+(?:\w*))(.*)(?=\n### |\Z)/m
27
+ change_rx = /(?<=\n|\A)### (\d+\.\d+\.\d+(?:\w*))(.*?)(?=\n### |\Z)/m
28
28
  @changes = @content.scan(change_rx).each_with_object([]) do |m, a|
29
29
  next if m[0].nil? || m[1].nil?
30
30
 
@@ -29,6 +29,7 @@ module Doing
29
29
  'plugin_path' => File.join(Util.user_home, '.config', 'doing', 'plugins'),
30
30
  'command_path' => File.join(Util.user_home, '.config', 'doing', 'commands')
31
31
  },
32
+ 'disabled_commands' => [],
32
33
  'doing_file' => '~/.local/share/doing/what_was_i_doing.md',
33
34
  'doing_file_sort' => 'desc',
34
35
  'backup_dir' => '~/.local/share/doing/doing_backup',
data/lib/doing/pager.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'pathname'
3
4
 
4
5
  module Doing
data/lib/doing/prompt.rb CHANGED
@@ -8,6 +8,14 @@ module Doing
8
8
 
9
9
  include Color
10
10
 
11
+ ##
12
+ ## Clear the terminal screen
13
+ ##
14
+ def clear_screen(msg = nil)
15
+ puts "\e[H\e[2J" if STDOUT.tty?
16
+ puts msg if msg.good?
17
+ end
18
+
11
19
  def force_answer
12
20
  @force_answer ||= nil
13
21
  end
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '2.1.25'
2
+ VERSION = '2.1.26'
3
3
  end
@@ -36,8 +36,7 @@ command :wiki do |c|
36
36
  c.switch [:only_timed], default_value: false, negatable: false
37
37
 
38
38
  c.action do |global, options, args|
39
- wwid = global[:wwid]
40
- tags = wwid.tag_groups([], opt: options)
39
+ tags = @wwid.tag_groups([], opt: options)
41
40
 
42
41
  wiki = Doing::Plugins.plugins.dig(:export, 'wiki', :class)
43
42
 
@@ -46,7 +45,7 @@ command :wiki do |c|
46
45
 
47
46
  raise RuntimeError, 'Missing plugin "wiki"' unless wiki
48
47
 
49
- out = wiki.render(wwid, items, variables: export_options)
48
+ out = wiki.render(@wwid, items, variables: export_options)
50
49
 
51
50
  if out
52
51
  FileUtils.mkdir_p('doing_wiki')
@@ -56,13 +55,13 @@ command :wiki do |c|
56
55
  end
57
56
  end
58
57
 
59
- template = if wwid.config['export_templates']['wiki_index'] && File.exist?(File.expand_path(wwid.config['export_templates']['wiki_index']))
60
- IO.read(File.expand_path(wwid.config['export_templates']['wiki_index']))
58
+ template = if @settings['export_templates']['wiki_index'] && File.exist?(File.expand_path(@settings['export_templates']['wiki_index']))
59
+ IO.read(File.expand_path(@settings['export_templates']['wiki_index']))
61
60
  else
62
61
  wiki.template('wiki_index')
63
62
  end
64
- style = if wwid.config['export_templates']['wiki_css'] && File.exist?(File.expand_path(wwid.config['export_templates']['wiki_css']))
65
- IO.read(File.expand_path(wwid.config['export_templates']['wiki_css']))
63
+ style = if @settings['export_templates']['wiki_css'] && File.exist?(File.expand_path(@settings['export_templates']['wiki_css']))
64
+ IO.read(File.expand_path(@settings['export_templates']['wiki_css']))
66
65
  else
67
66
  wiki.template('wiki_css')
68
67
  end
@@ -18,7 +18,7 @@ class ThreadedTests
18
18
  start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
19
19
  @results = File.expand_path('results.log')
20
20
 
21
- max_threads = 1000 if max_threads == 0
21
+ max_threads = 1000 if max_threads.to_i == 0
22
22
 
23
23
  c = Doing::Color
24
24
  c.coloring = true
@@ -27,8 +27,8 @@ class ThreadedTests
27
27
 
28
28
  tests = Dir.glob(pattern)
29
29
 
30
- if max_tests > 0
31
- tests = tests.slice(0, max_tests - 1)
30
+ if max_tests.to_i > 0
31
+ tests = tests.slice(0, max_tests.to_i - 1)
32
32
  end
33
33
 
34
34
  puts "#{tests.count} test files".boldcyan
@@ -89,24 +89,30 @@ class ThreadedTests
89
89
  finish_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
90
90
 
91
91
  progress.finish
92
+ rescue
93
+ progress.stop
94
+ ensure
95
+ msg = @running_tests.map { |t| t[1].format.uncolor.sub(/^\[:bar\] (.*?):status/, "#{c.bold}#{c.white}\\1#{c.reset}#{t[2]}") }.join("\n")
96
+
97
+ Doing::Prompt.clear_screen(msg)
92
98
 
93
99
  output = []
94
- if @error_out.count.positive?
95
- output << c.boldred("#{@error_out.count} Issues")
96
- else
97
- output << c.green('Success')
98
- end
100
+ output << if @error_out.count.positive?
101
+ c.boldred("#{@error_out.count} Issues")
102
+ else
103
+ c.green('Success')
104
+ end
99
105
  output << c.green("#{@test_total} tests")
100
106
  output << c.cyan("#{@assrt_total} assertions")
101
107
  output << c.yellow("#{(finish_time - start_time).round(3)}s")
102
108
  puts output.join(', ')
103
109
 
104
- puts @error_out.join("\n----\n".boldwhite) if @error_out.count.positive?
105
- rescue
106
- progress.stop
110
+ if @error_out.count.positive?
111
+ res = Doing::Prompt.yn('Display error report?', default_response: false)
112
+ Doing::Pager.paginate = true
113
+ Doing::Pager.page(@error_out.join("\n----\n".boldwhite)) if res
114
+ end
107
115
  end
108
- ensure
109
- FileUtils.rm(@results)
110
116
  end
111
117
 
112
118
  def run_test(s)
@@ -129,10 +135,12 @@ class ThreadedTests
129
135
  end
130
136
 
131
137
  @running_tests.push(s)
132
- out, _err, status = Open3.capture3(ENV, "rake test:#{s[0]} | tee #{@results}", stdin_data: nil)
133
- unless status.success?
134
- m = out.match(/(?<fail>\d+) failures, (?<err>\d+) errors/)
135
- s[2] = ": #{m['fail'].bold.red} #{'failures'.red}, #{m['err'].bold.red} #{'errors'.red}"
138
+ out, _err, status = Open3.capture3(ENV, 'rake', "test:#{s[0]}", stdin_data: nil)
139
+ time = out.match(/^Finished in (?<time>\d+\.\d+) seconds\./)
140
+ count = out.match(/^(?<tests>\d+) tests, (?<assrt>\d+) assertions, (?<fails>\d+) failures, (?<errs>\d+) errors/)
141
+
142
+ unless status.success? && !count['fails'].to_i.positive? && !count['errs'].to_i.positive?
143
+ s[2] = ": #{count['fails'].bold.red} #{'failures'.red}, #{count['errs'].bold.red} #{'errors'.red}"
136
144
  bar.update(head: '✖'.boldred)
137
145
  bar.advance(head: '✖'.boldred, status: s[2])
138
146
 
@@ -144,8 +152,6 @@ class ThreadedTests
144
152
  Thread.exit
145
153
  end
146
154
 
147
- time = out.match(/^Finished in (?<time>\d+\.\d+) seconds\./)
148
- count = out.match(/^(?<tests>\d+) tests, (?<assrt>\d+) assertions, (?<fails>\d+) failures, (?<errs>\d+) errors/)
149
155
  s[2] = [
150
156
  ': ',
151
157
  count['tests'].green,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.25
4
+ version: 2.1.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
@@ -456,6 +456,47 @@ files:
456
456
  - README.md
457
457
  - Rakefile
458
458
  - _config.yml
459
+ - bin/commands/add_section.rb
460
+ - bin/commands/again.rb
461
+ - bin/commands/archive.rb
462
+ - bin/commands/cancel.rb
463
+ - bin/commands/changes.rb
464
+ - bin/commands/choose.rb
465
+ - bin/commands/colors.rb
466
+ - bin/commands/commands.rb
467
+ - bin/commands/commands_accepting.rb
468
+ - bin/commands/completion.rb
469
+ - bin/commands/config.rb
470
+ - bin/commands/done.rb
471
+ - bin/commands/finish.rb
472
+ - bin/commands/flag.rb
473
+ - bin/commands/grep.rb
474
+ - bin/commands/import.rb
475
+ - bin/commands/install_fzf.rb
476
+ - bin/commands/last.rb
477
+ - bin/commands/meanwhile.rb
478
+ - bin/commands/note.rb
479
+ - bin/commands/now.rb
480
+ - bin/commands/on.rb
481
+ - bin/commands/open.rb
482
+ - bin/commands/plugins.rb
483
+ - bin/commands/recent.rb
484
+ - bin/commands/redo.rb
485
+ - bin/commands/reset.rb
486
+ - bin/commands/rotate.rb
487
+ - bin/commands/sections.rb
488
+ - bin/commands/select.rb
489
+ - bin/commands/show.rb
490
+ - bin/commands/since.rb
491
+ - bin/commands/tag.rb
492
+ - bin/commands/tag_dir.rb
493
+ - bin/commands/tags.rb
494
+ - bin/commands/template.rb
495
+ - bin/commands/today.rb
496
+ - bin/commands/undo.rb
497
+ - bin/commands/view.rb
498
+ - bin/commands/views.rb
499
+ - bin/commands/yesterday.rb
459
500
  - bin/doing
460
501
  - docs/_config.yml
461
502
  - docs/doc/Array.html
@@ -495,12 +536,14 @@ files:
495
536
  - docs/doc/Doing/Util/Backup.html
496
537
  - docs/doc/Doing/WWID.html
497
538
  - docs/doc/Doing/WWIDFile.html
539
+ - docs/doc/FalseClass.html
498
540
  - docs/doc/GLI.html
499
541
  - docs/doc/GLI/Commands.html
500
542
  - docs/doc/GLI/Commands/Help.html
501
543
  - docs/doc/GLI/Commands/MarkdownDocumentListener.html
502
544
  - docs/doc/Hash.html
503
545
  - docs/doc/Numeric.html
546
+ - docs/doc/Object.html
504
547
  - docs/doc/PhraseParser.html
505
548
  - docs/doc/PhraseParser/Operator.html
506
549
  - docs/doc/PhraseParser/PhraseClause.html
@@ -512,6 +555,7 @@ files:
512
555
  - docs/doc/String.html
513
556
  - docs/doc/Symbol.html
514
557
  - docs/doc/Time.html
558
+ - docs/doc/TrueClass.html
515
559
  - docs/doc/_index.html
516
560
  - docs/doc/class_list.html
517
561
  - docs/doc/css/common.css