doing 2.1.31pre → 2.1.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +58 -1
  3. data/Dockerfile-2.6 +3 -1
  4. data/Dockerfile-2.7 +4 -2
  5. data/Dockerfile-3.0 +3 -1
  6. data/Gemfile.lock +1 -71
  7. data/README.md +1 -1
  8. data/bash_profile +13 -0
  9. data/bin/commands/config.rb +16 -13
  10. data/bin/commands/done.rb +1 -1
  11. data/bin/commands/grep.rb +2 -29
  12. data/bin/commands/meanwhile.rb +1 -1
  13. data/bin/commands/now.rb +1 -1
  14. data/bin/commands/on.rb +6 -16
  15. data/bin/commands/open.rb +2 -2
  16. data/bin/commands/recent.rb +2 -14
  17. data/bin/commands/rotate.rb +17 -0
  18. data/bin/commands/sections.rb +82 -7
  19. data/bin/commands/show.rb +1 -21
  20. data/bin/commands/since.rb +5 -16
  21. data/bin/commands/tag_dir.rb +27 -3
  22. data/bin/commands/today.rb +3 -28
  23. data/bin/commands/yesterday.rb +2 -35
  24. data/bin/doing +9 -8
  25. data/docs/doc/Array.html +1 -1
  26. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  27. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  28. data/docs/doc/BooleanTermParser/Query.html +1 -1
  29. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  30. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  31. data/docs/doc/BooleanTermParser.html +1 -1
  32. data/docs/doc/Doing/Color.html +1 -1
  33. data/docs/doc/Doing/Completion.html +1 -1
  34. data/docs/doc/Doing/Configuration.html +3 -3
  35. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  36. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  37. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  38. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  39. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  40. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  41. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  42. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  43. data/docs/doc/Doing/Errors.html +1 -1
  44. data/docs/doc/Doing/Hooks.html +1 -1
  45. data/docs/doc/Doing/Item.html +20 -3
  46. data/docs/doc/Doing/Items.html +209 -1
  47. data/docs/doc/Doing/LogAdapter.html +1 -1
  48. data/docs/doc/Doing/Logger.html +1807 -0
  49. data/docs/doc/Doing/Note.html +1 -1
  50. data/docs/doc/Doing/Pager.html +1 -1
  51. data/docs/doc/Doing/Plugins.html +1 -1
  52. data/docs/doc/Doing/Prompt.html +1 -1
  53. data/docs/doc/Doing/Section.html +1 -1
  54. data/docs/doc/Doing/TemplateString.html +1 -1
  55. data/docs/doc/Doing/Types.html +3 -3
  56. data/docs/doc/Doing/Util/Backup.html +1 -1
  57. data/docs/doc/Doing/Util.html +1 -1
  58. data/docs/doc/Doing/WWID.html +3 -53
  59. data/docs/doc/Doing.html +4 -4
  60. data/docs/doc/FalseClass.html +1 -1
  61. data/docs/doc/GLI/Commands/Help.html +1 -1
  62. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  63. data/docs/doc/GLI/Commands.html +1 -1
  64. data/docs/doc/GLI.html +1 -1
  65. data/docs/doc/Hash.html +1 -1
  66. data/docs/doc/Object.html +1 -1
  67. data/docs/doc/PhraseParser/Operator.html +1 -1
  68. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  69. data/docs/doc/PhraseParser/Query.html +1 -1
  70. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  71. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  72. data/docs/doc/PhraseParser/TermClause.html +1 -1
  73. data/docs/doc/PhraseParser.html +1 -1
  74. data/docs/doc/Status.html +1 -1
  75. data/docs/doc/String.html +1 -1
  76. data/docs/doc/Symbol.html +1 -1
  77. data/docs/doc/Time.html +1 -1
  78. data/docs/doc/TrueClass.html +1 -1
  79. data/docs/doc/_index.html +10 -10
  80. data/docs/doc/class_list.html +1 -1
  81. data/docs/doc/file.README.html +2 -2
  82. data/docs/doc/index.html +2 -2
  83. data/docs/doc/method_list.html +407 -383
  84. data/docs/doc/top-level-namespace.html +1 -1
  85. data/docs/index.md +1 -1
  86. data/doing.gemspec +23 -24
  87. data/doing.rdoc +235 -18
  88. data/inputrc +57 -0
  89. data/lib/completion/_doing.zsh +47 -51
  90. data/lib/completion/doing.bash +12 -23
  91. data/lib/completion/doing.fish +39 -12
  92. data/lib/doing/add_options.rb +36 -1
  93. data/lib/doing/changelog/changes.rb +1 -1
  94. data/lib/doing/chronify/string.rb +1 -1
  95. data/lib/doing/completion/bash_completion.rb +1 -1
  96. data/lib/doing/completion/fish_completion.rb +2 -2
  97. data/lib/doing/completion/zsh_completion.rb +10 -4
  98. data/lib/doing/configuration.rb +7 -1
  99. data/lib/doing/item.rb +9 -2
  100. data/lib/doing/items.rb +48 -0
  101. data/lib/doing/{log_adapter.rb → logger.rb} +8 -2
  102. data/lib/doing/plugins/import/calendar_import.rb +1 -1
  103. data/lib/doing/plugins/import/doing_import.rb +1 -1
  104. data/lib/doing/plugins/import/timing_import.rb +1 -1
  105. data/lib/doing/string/tags.rb +1 -1
  106. data/lib/doing/types.rb +2 -2
  107. data/lib/doing/version.rb +1 -1
  108. data/lib/doing/wwid.rb +43 -43
  109. data/lib/doing.rb +4 -4
  110. data/lib/examples/plugins/capture_thing_import.rb +1 -1
  111. data/lib/helpers/threaded_tests.rb +2 -0
  112. metadata +101 -138
  113. data/.yardoc/checksums +0 -30
  114. data/.yardoc/complete +0 -0
  115. data/.yardoc/object_types +0 -0
  116. data/.yardoc/objects/root.dat +0 -0
  117. data/.yardoc/proxy_types +0 -0
  118. data/bin/commands/add_section.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c152d41e8fed6a743649d5f9636c25bce404a90993054f07349da019f12c3327
4
- data.tar.gz: 4c72e57749bef87e7cf0c39a7bf73b7365c2b9b2e04537a39c226edf46a2819c
3
+ metadata.gz: c3baa4d1dff66b135022d39086ac551ece87361d14c70639bbe58ac5c9499dab
4
+ data.tar.gz: 6c2ad9f3af8b875282cd2c57468b8b34d34f8e6adc17641aefe2974b32629e7b
5
5
  SHA512:
6
- metadata.gz: d3781121aaa1e6e50bb98bcd1317eb06c99f5ed6af89faea623f8b9c693037b69d8ad0de11ab6eb2d1082edb5cb1060511e672fb40e81e33cf6a7e3306331e99
7
- data.tar.gz: d6e1d839dae29830d832fedd0d92f4a05227086474e515e66e013ff22370f05bd9881ad1ab6790b0e6ac64e8e17b4d5a1c69c03b1a1b46c44d91a334e5b28f65
6
+ metadata.gz: 4c74473d2060b9431c5aad63a2ad10fdb370b32789a5db4f6a0fc28552498361a42b0670a31dc3c4e344f04b4e2af2114a4fa545fb0362b4a7161a5105911a0b
7
+ data.tar.gz: 7f2567fb0fbd60a90064c5c8f1cfa5466dae5876ccbf0ff16580d3593f4fac6643924c2ef0315dc6dda8a76933292d523ccdfbecff6eb7cc8a18dc417ec9c752
data/CHANGELOG.md CHANGED
@@ -1,4 +1,61 @@
1
- ### 2.1.31pre
1
+ ### 2.1.35
2
+
3
+ 2022-02-21 14:53
4
+
5
+ #### FIXED
6
+
7
+ - Revert switch to sys-uname, hopefully solve crash
8
+
9
+ ### 2.1.34
10
+
11
+ 2022-02-20 09:32
12
+
13
+ #### IMPROVED
14
+
15
+ - Allow `--from 8am` time range without end time to mean `8am to 11:59pm`
16
+ - `--tag_order` for commands with `--totals` output that were missing it
17
+ - Tag and search filters for on, since, today and yesterday
18
+ - Time filters for today and yesterday
19
+ - `--only_timed` filter for yesterday
20
+ - `--only_timed` for today
21
+ - Remove exact duplicates from content before saving
22
+ - `doing sections` now has subcommands -- `sections list`, `sections add SECTION` (replaces `add_section`) and `sections remove SECTION` allows removal of a section and archiving of its contents
23
+
24
+ #### FIXED
25
+
26
+ - `doing yesterday --from` not filtering time range
27
+ - Don't return a duration or interval for entries configured as never_time or never_finish
28
+ - `--from` time filter for yesterday
29
+ - Regex error in `doing archive`
30
+ - `--times` error in `doing today`
31
+
32
+ ### 2.1.33
33
+
34
+ 2022-02-18 12:09
35
+
36
+ #### FIXED
37
+
38
+ - Major fixes for completion scripts, especially zsh
39
+
40
+ ### 2.1.32
41
+
42
+ 2022-02-18 08:34
43
+
44
+ #### NEW
45
+
46
+ - `doing config set --local` flag to force updates to local .doingrc, creating if it doesn't exist, and bypassing menu selection
47
+
48
+ #### IMPROVED
49
+
50
+ - `doing tag_dir` will not allow duplicate tags or tags that are already applied by a config higher up the hierarchy
51
+ - `doing tag_dir` will force updates to .doingrc in the current directory rather than offering a menu
52
+
53
+ #### FIXED
54
+
55
+ - When running without subcommand, e.g. `doing this thing`, the first word was being lost
56
+ - Remove blank lines when running `doing changes --changes --md` (output changes only in Markdown format)
57
+
58
+ ### 2.1.31
2
59
 
3
60
  2022-02-17 12:59
4
61
 
data/Dockerfile-2.6 CHANGED
@@ -5,5 +5,7 @@ WORKDIR /doing
5
5
  # COPY ./ /doing/
6
6
  RUN gem install bundler:2.2.17
7
7
  RUN apt-get update -y
8
- RUN apt-get install -y less
8
+ RUN apt-get install -y less vim
9
+ COPY ./inputrc /root/.inputrc
10
+ COPY ./bash_profile /root/.bash_profile
9
11
  CMD ["scripts/runtests.sh"]
data/Dockerfile-2.7 CHANGED
@@ -1,9 +1,11 @@
1
1
  FROM ruby:2.7
2
- RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
2
+ # RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
3
3
  RUN mkdir /doing
4
4
  WORKDIR /doing
5
5
  # COPY ./ /doing/
6
6
  RUN gem install bundler:2.2.17
7
7
  RUN apt-get update -y
8
- RUN apt-get install -y less
8
+ RUN apt-get install -y less vim
9
+ COPY ./inputrc /root/.inputrc
10
+ COPY ./bash_profile /root/.bash_profile
9
11
  CMD ["scripts/runtests.sh"]
data/Dockerfile-3.0 CHANGED
@@ -5,5 +5,7 @@ WORKDIR /doing
5
5
  # COPY ./ /doing/
6
6
  RUN gem install bundler:2.2.17
7
7
  RUN apt-get update -y
8
- RUN apt-get install -y less
8
+ RUN apt-get install -y less vim
9
+ COPY ./inputrc /root/.inputrc
10
+ COPY ./bash_profile /root/.bash_profile
9
11
  CMD ["scripts/runtests.sh"]
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- doing (2.1.31pre)
4
+ doing (2.1.35)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
6
  deep_merge (~> 1.2, >= 1.2.1)
7
7
  gli (~> 2.20, >= 2.20.1)
@@ -9,7 +9,6 @@ PATH
9
9
  parslet (~> 2.0, >= 2.0.0)
10
10
  plist (~> 3.6, >= 3.6.0)
11
11
  safe_yaml (~> 1.0)
12
- sys-uname (~> 1.2, >= 1.2.2)
13
12
  tty-link (~> 0.1, >= 0.1.1)
14
13
  tty-markdown (~> 0.7, >= 0.7.0)
15
14
  tty-progressbar (~> 0.18, >= 0.18.2)
@@ -20,68 +19,15 @@ PATH
20
19
  GEM
21
20
  remote: http://rubygems.org/
22
21
  specs:
23
- activesupport (7.0.1)
24
- concurrent-ruby (~> 1.0, >= 1.0.2)
25
- i18n (>= 1.6, < 2)
26
- minitest (>= 5.1)
27
- tzinfo (~> 2.0)
28
- aruba (1.0.4)
29
- childprocess (>= 2.0, < 5.0)
30
- contracts (~> 0.16.0)
31
- cucumber (>= 2.4, < 6.0)
32
- rspec-expectations (~> 3.4)
33
- thor (~> 1.0)
34
- builder (3.2.4)
35
- childprocess (4.1.0)
36
22
  chronic (0.10.2)
37
- concurrent-ruby (1.1.9)
38
- contracts (0.16.1)
39
- cucumber (5.3.0)
40
- builder (~> 3.2, >= 3.2.4)
41
- cucumber-core (~> 8.0, >= 8.0.1)
42
- cucumber-create-meta (~> 2.0, >= 2.0.2)
43
- cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
44
- cucumber-gherkin (~> 15.0, >= 15.0.2)
45
- cucumber-html-formatter (~> 9.0, >= 9.0.0)
46
- cucumber-messages (~> 13.1, >= 13.1.0)
47
- cucumber-wire (~> 4.0, >= 4.0.1)
48
- diff-lcs (~> 1.4, >= 1.4.4)
49
- multi_test (~> 0.1, >= 0.1.2)
50
- sys-uname (~> 1.2, >= 1.2.1)
51
- cucumber-core (8.0.1)
52
- cucumber-gherkin (~> 15.0, >= 15.0.2)
53
- cucumber-messages (~> 13.0, >= 13.0.1)
54
- cucumber-tag-expressions (~> 2.0, >= 2.0.4)
55
- cucumber-create-meta (2.0.4)
56
- cucumber-messages (~> 13.1, >= 13.1.0)
57
- sys-uname (~> 1.2, >= 1.2.1)
58
- cucumber-cucumber-expressions (10.3.0)
59
- cucumber-gherkin (15.0.2)
60
- cucumber-messages (~> 13.0, >= 13.0.1)
61
- cucumber-html-formatter (9.0.0)
62
- cucumber-messages (~> 13.0, >= 13.0.1)
63
- cucumber-messages (13.2.1)
64
- protobuf-cucumber (~> 3.10, >= 3.10.8)
65
- cucumber-tag-expressions (2.0.4)
66
- cucumber-wire (4.0.1)
67
- cucumber-core (~> 8.0, >= 8.0.1)
68
- cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
69
- cucumber-messages (~> 13.0, >= 13.0.1)
70
23
  deep_merge (1.2.2)
71
- diff-lcs (1.5.0)
72
- ffi (1.15.5)
73
24
  github-markup (4.0.0)
74
25
  gli (2.20.1)
75
26
  haml (5.0.4)
76
27
  temple (>= 0.8.0)
77
28
  tilt
78
- i18n (1.8.11)
79
- concurrent-ruby (~> 1.0)
80
29
  kramdown (2.3.1)
81
30
  rexml
82
- middleware (0.1.0)
83
- minitest (5.15.0)
84
- multi_test (0.1.2)
85
31
  parallel (1.21.0)
86
32
  parallel_tests (3.7.3)
87
33
  parallel
@@ -90,33 +36,20 @@ GEM
90
36
  tty-color (~> 0.5)
91
37
  plist (3.6.0)
92
38
  power_assert (2.0.1)
93
- protobuf-cucumber (3.10.8)
94
- activesupport (>= 3.2)
95
- middleware
96
- thor
97
- thread_safe
98
39
  rake (13.0.6)
99
40
  rdoc (6.3.3)
100
41
  redcarpet (3.5.1)
101
42
  rexml (3.2.5)
102
43
  rouge (3.27.0)
103
- rspec-expectations (3.10.2)
104
- diff-lcs (>= 1.2.0, < 2.0)
105
- rspec-support (~> 3.10.0)
106
- rspec-support (3.10.3)
107
44
  safe_yaml (1.0.5)
108
45
  strings (0.2.1)
109
46
  strings-ansi (~> 0.2)
110
47
  unicode-display_width (>= 1.5, < 3.0)
111
48
  unicode_utils (~> 1.4)
112
49
  strings-ansi (0.2.0)
113
- sys-uname (1.2.2)
114
- ffi (~> 1.1)
115
50
  temple (0.8.2)
116
51
  test-unit (3.4.9)
117
52
  power_assert
118
- thor (1.2.1)
119
- thread_safe (0.3.6)
120
53
  tilt (2.0.10)
121
54
  tty-color (0.6.0)
122
55
  tty-cursor (0.7.1)
@@ -141,8 +74,6 @@ GEM
141
74
  tty-spinner (0.9.3)
142
75
  tty-cursor (~> 0.7)
143
76
  tty-which (0.5.0)
144
- tzinfo (2.0.4)
145
- concurrent-ruby (~> 1.0)
146
77
  unicode-display_width (2.1.0)
147
78
  unicode_utils (1.4.0)
148
79
  webrick (1.7.0)
@@ -154,7 +85,6 @@ PLATFORMS
154
85
  ruby
155
86
 
156
87
  DEPENDENCIES
157
- aruba (~> 1.0.2)
158
88
  doing!
159
89
  github-markup (~> 4.0, >= 4.0.0)
160
90
  parallel_tests (~> 3.7, >= 3.7.3)
data/README.md CHANGED
@@ -8,7 +8,7 @@ _If you're one of the rare people like me who find this useful, feel free to
8
8
 
9
9
  <!--README-->
10
10
 
11
- The current version of `doing` is <!--VER-->2.1.30<!--END VER-->.
11
+ The current version of `doing` is <!--VER-->2.1.34<!--END VER-->.
12
12
 
13
13
  Find all of the documentation in the [doing wiki][wiki].
14
14
 
data/bash_profile ADDED
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+ export GLI_DEBUG=true
3
+ export EDITOR="/usr/bin/vim"
4
+ alias bdoing="GLI_DEBUG=true bundle exec bin/doing"
5
+
6
+ shopt -s nocaseglob
7
+ shopt -s histappend
8
+ shopt -s histreedit
9
+ shopt -s histverify
10
+ shopt -s cmdhist
11
+
12
+ cd /doing
13
+ bundle install
@@ -43,9 +43,9 @@ command :config do |c|
43
43
 
44
44
  edit.desc 'Editor to use'
45
45
  edit.arg_name 'EDITOR'
46
- edit.flag %i[e editor], default_value: nil
46
+ edit.flag %i[e editor]
47
47
 
48
- if Sys::Platform.mac?
48
+ if `uname` =~ /Darwin/
49
49
  edit.desc 'Application to use'
50
50
  edit.arg_name 'APP_NAME'
51
51
  edit.flag %i[a app]
@@ -54,8 +54,8 @@ command :config do |c|
54
54
  edit.arg_name 'BUNDLE_ID'
55
55
  edit.flag %i[b bundle_id]
56
56
 
57
- edit.desc "Use the config_editor_app defined in ~/.config/doing/config.yml (#{@settings.key?('config_editor_app') ? @settings['config_editor_app'] : 'config_editor_app not set'})"
58
- edit.switch %i[x default]
57
+ edit.desc "Use the config editor defined in ~/.config/doing/config.yml (#{Doing.setting('editors.config', 'editors.config not set')})"
58
+ edit.switch %i[x default], negatable: false
59
59
  end
60
60
 
61
61
  edit.action do |global, options, args|
@@ -76,7 +76,7 @@ command :config do |c|
76
76
 
77
77
  config_file = Doing.config.choose_config
78
78
 
79
- if Sys::Platform.mac?
79
+ if `uname` =~ /Darwin/
80
80
  if options[:default]
81
81
  editor = Doing::Util.find_default_editor('config')
82
82
  if editor
@@ -191,7 +191,10 @@ command :config do |c|
191
191
  set.example 'doing config set plug.plugpath ~/my_plugins', desc: 'Key path is fuzzy matched: set the value of plugins.plugin_path'
192
192
 
193
193
  set.desc 'Delete specified key'
194
- set.switch %i[r remove], default_value: false, negatable: false
194
+ set.switch %i[r remove], negatable: false
195
+
196
+ set.desc 'Force update to .doingrc in the current directory'
197
+ set.switch %[local], negatable: false
195
198
 
196
199
  set.action do |_global, options, args|
197
200
  if args.count < 2 && !options[:remove]
@@ -202,7 +205,7 @@ command :config do |c|
202
205
  value = options[:remove] ? nil : args.pop
203
206
  keypath = args.join('.')
204
207
  real_path = Doing.config.resolve_key_path(keypath, create: true)
205
- old_value = @settings.dig(*real_path)
208
+ old_value = Doing.config.settings.dig(*real_path)
206
209
  old_type = old_value&.class.to_s || nil
207
210
 
208
211
  if old_value.is_a?(Hash) && !options[:remove]
@@ -216,11 +219,11 @@ command :config do |c|
216
219
 
217
220
  end
218
221
 
219
- config_file = Doing.config.choose_config(create: true)
222
+ config_file = Doing.config.choose_config(create: true, local: options[:local])
220
223
 
221
224
  cfg = Doing::Util.safe_load_file(config_file) || {}
222
225
 
223
- $stderr.puts "Updating #{config_file}".yellow
226
+ $stderr.puts "> Config: Updating #{config_file}".yellow
224
227
 
225
228
  if options[:remove]
226
229
  cfg.deep_set(real_path, nil)
@@ -228,10 +231,10 @@ command :config do |c|
228
231
  else
229
232
  current_value = cfg.dig(*real_path)
230
233
  cfg.deep_set(real_path, value.set_type(old_type))
231
- $stderr.puts "#{' Key path:'.yellow} #{real_path.join('.').boldwhite}"
232
- $stderr.puts "#{'Inherited:'.yellow} #{(old_value ? old_value.to_s : 'empty').boldwhite}"
233
- $stderr.puts "#{' Current:'.yellow} #{ (current_value ? current_value.to_s : 'empty').boldwhite }"
234
- $stderr.puts "#{' New:'.yellow} #{value.set_type(old_type).to_s.boldwhite}"
234
+ $stderr.puts "#{' Key path:'.yellow} #{real_path.join('.').boldwhite}"
235
+ $stderr.puts "#{' Inherited:'.yellow} #{(old_value ? old_value.to_s : 'empty').boldwhite}"
236
+ $stderr.puts "#{' Current:'.yellow} #{ (current_value ? current_value.to_s : 'empty').boldwhite }"
237
+ $stderr.puts "#{' New:'.yellow} #{value.set_type(old_type).to_s.boldwhite}"
235
238
  end
236
239
 
237
240
  res = Doing::Prompt.yn('Update selected config', default_response: true)
data/bin/commands/done.rb CHANGED
@@ -47,7 +47,7 @@ command %i[done did] do |c|
47
47
  add_options(:add_entry, c)
48
48
 
49
49
  c.action do |_global_options, options, args|
50
- @wwid.auto_tag = !options[:noauto]
50
+ Doing.auto_tag = !options[:noauto]
51
51
 
52
52
  took = 0
53
53
  donedate = nil
data/bin/commands/grep.rb CHANGED
@@ -28,31 +28,12 @@ command %i[grep search] do |c|
28
28
  c.arg_name 'TEMPLATE_STRING'
29
29
  c.flag [:template]
30
30
 
31
- c.desc 'Show time intervals on @done tasks'
32
- c.switch %i[t times], default_value: true, negatable: true
33
-
34
- c.desc 'Show elapsed time on entries without @done tag'
35
- c.switch [:duration]
36
-
37
- c.desc 'Show intervals with totals at the end of output'
38
- c.switch [:totals], default_value: false, negatable: false
39
-
40
- c.desc 'Sort tags by (name|time)'
41
- default = Doing.setting('tag_sort').normalize_tag_sort || :name
42
- c.arg_name 'KEY'
43
- c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
44
-
45
- c.desc 'Only show items with recorded time intervals'
46
- c.switch [:only_timed], default_value: false, negatable: false
47
-
48
31
  # c.desc '[DEPRECATED] Use alternative fuzzy matching for search string'
49
32
  # c.switch [:fuzzy], default_value: false, negatable: false
50
33
 
51
34
  c.desc 'Force exact string matching (case sensitive)'
52
35
  c.switch %i[x exact], default_value: Doing.config.exact_match?, negatable: Doing.config.exact_match?
53
36
 
54
- c.desc 'Show items that *don\'t* match search string'
55
- c.switch [:not], default_value: false, negatable: false
56
37
 
57
38
  c.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'
58
39
  c.arg_name 'TYPE'
@@ -72,17 +53,9 @@ command %i[grep search] do |c|
72
53
  c.desc 'Display an interactive menu of results to perform further operations'
73
54
  c.switch %i[i interactive], default_value: false, negatable: false
74
55
 
75
- c.desc 'Perform a tag value query ("@done > two hours ago" or "@progress < 50"). May be used multiple times, combined with --bool'
76
- c.arg_name 'QUERY'
77
- c.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY
78
-
79
- c.desc 'Combine multiple tags or value queries using AND, OR, or NOT'
80
- c.arg_name 'BOOLEAN'
81
- c.flag [:bool], must_match: REGEX_BOOL,
82
- default_value: :pattern,
83
- type: BooleanSymbol
84
-
56
+ add_options(:tag_filter, c)
85
57
  add_options(:date_filter, c)
58
+ add_options(:time_display, c)
86
59
 
87
60
  c.action do |_global_options, options, args|
88
61
  options[:fuzzy] = false
@@ -21,7 +21,7 @@ command :meanwhile do |c|
21
21
  add_options(:add_entry, c)
22
22
 
23
23
  c.action do |_global_options, options, args|
24
- @wwid.auto_tag = !options[:noauto]
24
+ Doing.auto_tag = !options[:noauto]
25
25
 
26
26
  if options[:back]
27
27
  date = options[:back]
data/bin/commands/now.rb CHANGED
@@ -37,7 +37,7 @@ command %i[now next] do |c|
37
37
  # # c.flag [:a, :app]
38
38
 
39
39
  c.action do |_global_options, options, args|
40
- @wwid.auto_tag = !options[:noauto]
40
+ Doing.auto_tag = !options[:noauto]
41
41
 
42
42
  raise InvalidArgument, '--back and --from cannot be used together' if options[:back] && options[:from]
43
43
 
data/bin/commands/on.rb CHANGED
@@ -13,20 +13,6 @@ command :on do |c|
13
13
  c.arg_name 'NAME'
14
14
  c.flag %i[s section], default_value: 'All'
15
15
 
16
- c.desc 'Show time intervals on @done tasks'
17
- c.switch %i[t times], default_value: true, negatable: true
18
-
19
- c.desc 'Show elapsed time on entries without @done tag'
20
- c.switch [:duration]
21
-
22
- c.desc 'Show time totals at the end of output'
23
- c.switch [:totals], default_value: false, negatable: false
24
-
25
- c.desc 'Sort tags by (name|time)'
26
- default = Doing.setting('tag_sort').normalize_tag_sort || :name
27
- c.arg_name 'KEY'
28
- c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
29
-
30
16
  c.desc "Output to export format (#{Doing::Plugins.plugin_names(type: :export)})"
31
17
  c.arg_name 'FORMAT'
32
18
  c.flag %i[o output]
@@ -39,6 +25,11 @@ command :on do |c|
39
25
  c.arg_name 'TEMPLATE_STRING'
40
26
  c.flag [:template]
41
27
 
28
+ add_options(:time_display, c)
29
+ add_options(:search, c)
30
+ add_options(:tag_filter, c)
31
+ add_options(:time_filter, c)
32
+
42
33
  c.action do |_global_options, options, args|
43
34
  raise DoingRuntimeError, %(Invalid output type "#{options[:output]}") if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)
44
35
 
@@ -59,7 +50,6 @@ command :on do |c|
59
50
  options[:times] = true if options[:totals]
60
51
  options[:sort_tags] = options[:tag_sort]
61
52
 
62
- Doing::Pager.page @wwid.list_date([start, finish], options[:section], options[:times], options[:output],
63
- { template: options[:template], config_template: options[:config_template], duration: options[:duration], totals: options[:totals], sort_tags: options[:sort_tags] }).chomp
53
+ Doing::Pager.page @wwid.list_date([start, finish], options[:section], options[:times], options[:output], options).chomp
64
54
  end
65
55
  end
data/bin/commands/open.rb CHANGED
@@ -8,7 +8,7 @@ command :open do |c|
8
8
  c.arg_name 'COMMAND'
9
9
  c.flag %i[e editor]
10
10
 
11
- if Sys::Platform.mac?
11
+ if `uname` =~ /Darwin/
12
12
  c.desc 'Open with app name'
13
13
  c.arg_name 'APP_NAME'
14
14
  c.flag %i[a app]
@@ -29,7 +29,7 @@ command :open do |c|
29
29
 
30
30
  editor = TTY::Which.which(options[:editor])
31
31
  system %(#{editor} "#{File.expand_path(@wwid.doing_file)}")
32
- elsif Sys::Platform.mac?
32
+ elsif `uname` =~ /Darwin/
33
33
  if options[:app]
34
34
  system %(open -a "#{options[:app]}" "#{File.expand_path(@wwid.doing_file)}")
35
35
  elsif options[:bundle_id]
@@ -12,9 +12,6 @@ command :recent do |c|
12
12
  c.arg_name 'NAME'
13
13
  c.flag %i[s section], default_value: 'All'
14
14
 
15
- c.desc 'Show time intervals on @done tasks'
16
- c.switch %i[t times], default_value: true, negatable: true
17
-
18
15
  c.desc "Output using a template from configuration"
19
16
  c.arg_name 'TEMPLATE_KEY'
20
17
  c.flag [:config_template], type: TemplateName, default_value: 'recent'
@@ -23,20 +20,11 @@ command :recent do |c|
23
20
  c.arg_name 'TEMPLATE_STRING'
24
21
  c.flag [:template]
25
22
 
26
- c.desc 'Show elapsed time on entries without @done tag'
27
- c.switch [:duration]
28
-
29
- c.desc 'Show intervals with totals at the end of output'
30
- c.switch [:totals], default_value: false, negatable: false
31
-
32
- c.desc 'Sort tags by (name|time)'
33
- default = Doing.setting('tag_sort').normalize_tag_sort || :name
34
- c.arg_name 'KEY'
35
- c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
36
-
37
23
  c.desc 'Select from a menu of matching entries to perform additional operations'
38
24
  c.switch %i[i interactive], negatable: false, default_value: false
39
25
 
26
+ add_options(:time_display, c)
27
+
40
28
  c.action do |global_options, options, args|
41
29
  section = @wwid.guess_section(options[:section]) || options[:section].cap_first
42
30
 
@@ -40,3 +40,20 @@ command :rotate do |c|
40
40
  @wwid.rotate(options)
41
41
  end
42
42
  end
43
+
44
+ # # @@doctor
45
+
46
+ # desc 'Doing file maintenance.'
47
+ # long_desc %(Duplicate entries compressed to a single entry. This will modify the doing file.)
48
+ # command :doctor do |c|
49
+ # c.example 'doing doctor', desc: 'Clean up the Doing file, sorting and removing duplicates'
50
+
51
+ # c.desc 'Only remove duplicates in the same section'
52
+ # c.switch %i[s same_section], negatable: false, default_value: false
53
+
54
+ # c.action do |_global_options, options, _args|
55
+ # @wwid.content.dedup!(match_section: options[:same_section])
56
+ # @wwid.write(@wwid.doing_file)
57
+ # end
58
+ # end
59
+
@@ -1,11 +1,86 @@
1
- # @@sections
2
- desc 'List sections'
1
+ # frozen_string_literal: true
2
+
3
+ # @@add_section
4
+ desc 'List, add, or remove sections in the Doing file'
3
5
  command :sections do |c|
4
- c.desc 'List in single column'
5
- c.switch %i[c column], negatable: false, default_value: false
6
+ c.default_command :list
7
+
8
+ c.example 'doing sections add Ideas', desc: 'Add a section called Ideas to the doing file'
9
+ c.example 'doing sections remove Reminders', desc: 'Remove the section Reminders'
10
+ c.example 'doing sections list', desc: 'List all sections'
11
+
12
+ c.desc 'Add a section'
13
+ c.arg_name 'SECTION_NAME'
14
+ c.command :add do |add|
15
+ add.action do |_g, _o, args|
16
+ raise InvalidArgument, "Section #{args[0]} already exists" if @wwid.sections.include?(args[0])
17
+
18
+ @wwid.content.add_section(args.join(' ').cap_first, log: true)
19
+ @wwid.write(@wwid.doing_file)
20
+ end
21
+ end
22
+
23
+ c.desc 'List sections'
24
+ c.command :list do |list|
25
+ list.desc 'List in single column'
26
+ list.switch %i[c column], negatable: false, default_value: false
27
+
28
+ list.action do |_global_options, options, _args|
29
+ joiner = options[:column] ? "\n" : "\t"
30
+ print @wwid.content.section_titles.join(joiner)
31
+ end
32
+ end
33
+
34
+ c.desc 'Remove a section'
35
+ c.arg_name 'SECTION_NAME'
36
+ c.command :remove do |remove|
37
+ remove.desc 'Archive entries in section before deleting. --no-archive permanently deletes section contents'
38
+ remove.switch %i[a archive], default_value: true, negatable: true
39
+
40
+ remove.action do |_g, options, args|
41
+ raise InvalidArgument, '--delete cannot be used with --archive' if options[:delete] && options[:archive]
42
+
43
+ section = args[0].cap_first
44
+
45
+ unless @wwid.sections.include?(section)
46
+ Doing.logger.log_now(:warn, 'Section:', "#{section} not found, did you mean #{guess_section(section)}?")
47
+ raise InvalidArgument, "Section #{args[0]} doesn't exist"
6
48
 
7
- c.action do |_global_options, options, _args|
8
- joiner = options[:column] ? "\n" : "\t"
9
- print @wwid.content.section_titles.join(joiner)
49
+ end
50
+
51
+ items = @wwid.content.in_section(section)
52
+
53
+ if items.count.positive?
54
+ res = Doing::Prompt.yn("#{options[:archive] ? 'Archive' : 'Delete'} #{items.count} entries from #{section}", default_response: 'n')
55
+
56
+ if options[:archive] && res
57
+ @wwid.archive(section, {keep: 0})
58
+ elsif res
59
+ items.each { |item| @wwid.content.delete_item(item) }
60
+ end
61
+ end
62
+
63
+ @wwid.content.delete_section(section, log: true)
64
+
65
+ @wwid.write(@wwid.doing_file)
66
+ end
67
+ end
68
+ end
69
+
70
+ # For backward compatibility
71
+ # @@add_section
72
+ command :add_section do |c|
73
+ c.desc 'Archive entries in section before deleting'
74
+ c.switch %i[a archive], default_value: true, negatable: true
75
+
76
+ c.desc 'Permanently delete entries in section'
77
+ c.switch %i[d delete], default_value: false
78
+
79
+ c.action do |g, o, a|
80
+ cmd = commands[:sections].commands[:add]
81
+
82
+ action = cmd.send(:get_action, nil)
83
+ action.call(g, o, a)
10
84
  end
11
85
  end
86
+
data/bin/commands/show.rb CHANGED
@@ -33,27 +33,6 @@ command :show do |c|
33
33
  c.arg_name 'ORDER'
34
34
  c.flag %i[s sort], must_match: REGEX_SORT_ORDER, default_value: :asc, type: OrderSymbol
35
35
 
36
- c.desc 'Show time intervals on @done tasks'
37
- c.switch %i[t times], default_value: true, negatable: true
38
-
39
- c.desc 'Show elapsed time on entries without @done tag'
40
- c.switch [:duration]
41
-
42
- c.desc 'Show intervals with totals at the end of output'
43
- c.switch [:totals], default_value: false, negatable: false
44
-
45
- c.desc 'Sort tags by (name|time)'
46
- default = Doing.setting('tag_sort').normalize_tag_sort || :name
47
- c.arg_name 'KEY'
48
- c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
49
-
50
- c.desc 'Tag sort direction (asc|desc)'
51
- c.arg_name 'DIRECTION'
52
- c.flag [:tag_order], must_match: REGEX_SORT_ORDER, default_value: :asc, type: OrderSymbol
53
-
54
- c.desc 'Only show items with recorded time intervals'
55
- c.switch [:only_timed], default_value: false, negatable: false
56
-
57
36
  c.desc "Output using a template from configuration"
58
37
  c.arg_name 'TEMPLATE_KEY'
59
38
  c.flag [:config_template], type: TemplateName, default_value: 'default'
@@ -72,6 +51,7 @@ command :show do |c|
72
51
  c.arg_name 'FORMAT'
73
52
  c.flag %i[o output]
74
53
 
54
+ add_options(:time_display, c)
75
55
  add_options(:search, c)
76
56
  add_options(:tag_filter, c)
77
57
  add_options(:date_filter, c)