doing 2.1.26 → 2.1.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/.yardoc/checksums +15 -20
  3. data/.yardoc/object_types +0 -0
  4. data/.yardoc/objects/root.dat +0 -0
  5. data/CHANGELOG.md +52 -0
  6. data/Dockerfile +5 -5
  7. data/Dockerfile-2.6 +5 -5
  8. data/Dockerfile-2.7 +5 -4
  9. data/Dockerfile-3.0 +5 -4
  10. data/Gemfile.lock +2 -1
  11. data/README.md +1 -1
  12. data/Rakefile +2 -3
  13. data/bin/commands/add_section.rb +2 -0
  14. data/bin/commands/again.rb +23 -65
  15. data/bin/commands/archive.rb +20 -61
  16. data/bin/commands/cancel.rb +27 -69
  17. data/bin/commands/changes.rb +53 -12
  18. data/bin/commands/colors.rb +4 -2
  19. data/bin/commands/commands.rb +4 -2
  20. data/bin/commands/commands_accepting.rb +62 -11
  21. data/bin/commands/completion.rb +10 -7
  22. data/bin/commands/config.rb +8 -8
  23. data/bin/commands/done.rb +3 -17
  24. data/bin/commands/finish.rb +7 -30
  25. data/bin/commands/flag.rb +15 -51
  26. data/bin/commands/grep.rb +12 -28
  27. data/bin/commands/import.rb +3 -33
  28. data/bin/commands/last.rb +3 -36
  29. data/bin/commands/meanwhile.rb +3 -13
  30. data/bin/commands/note.rb +13 -52
  31. data/bin/commands/now.rb +15 -21
  32. data/bin/commands/on.rb +3 -4
  33. data/bin/commands/open.rb +3 -3
  34. data/bin/commands/recent.rb +3 -4
  35. data/bin/commands/redo.rb +6 -2
  36. data/bin/commands/reset.rb +19 -52
  37. data/bin/commands/rotate.rb +5 -36
  38. data/bin/commands/select.rb +23 -41
  39. data/bin/commands/show.rb +28 -74
  40. data/bin/commands/since.rb +3 -4
  41. data/bin/commands/tag.rb +4 -34
  42. data/bin/commands/tags.rb +5 -32
  43. data/bin/commands/today.rb +3 -4
  44. data/bin/commands/view.rb +36 -73
  45. data/bin/commands/yesterday.rb +4 -5
  46. data/bin/doing +150 -13
  47. data/docs/doc/Array.html +3 -502
  48. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  49. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  50. data/docs/doc/BooleanTermParser/Query.html +1 -1
  51. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  52. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  53. data/docs/doc/BooleanTermParser.html +1 -1
  54. data/docs/doc/Doing/Color.html +62 -56
  55. data/docs/doc/Doing/Completion.html +1 -1
  56. data/docs/doc/Doing/Configuration.html +35 -1
  57. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  58. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  59. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  60. data/docs/doc/Doing/Errors/EmptyInput.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/Hooks.html +1 -1
  67. data/docs/doc/Doing/Item.html +1 -1
  68. data/docs/doc/Doing/Items.html +2 -2
  69. data/docs/doc/Doing/LogAdapter.html +1 -1
  70. data/docs/doc/Doing/Note.html +2 -2
  71. data/docs/doc/Doing/Pager.html +1 -1
  72. data/docs/doc/Doing/Plugins.html +1 -1
  73. data/docs/doc/Doing/Prompt.html +1 -1
  74. data/docs/doc/Doing/Section.html +1 -1
  75. data/docs/doc/Doing/TemplateString.html +2 -2
  76. data/docs/doc/Doing/Types.html +41 -1
  77. data/docs/doc/Doing/Util/Backup.html +1 -1
  78. data/docs/doc/Doing/Util.html +1 -1
  79. data/docs/doc/Doing/WWID.html +10 -10
  80. data/docs/doc/Doing.html +3 -3
  81. data/docs/doc/FalseClass.html +35 -1
  82. data/docs/doc/GLI/Commands/Help.html +1 -1
  83. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  84. data/docs/doc/GLI/Commands.html +1 -1
  85. data/docs/doc/GLI.html +1 -1
  86. data/docs/doc/Hash.html +1 -1
  87. data/docs/doc/Object.html +1 -1
  88. data/docs/doc/PhraseParser/Operator.html +1 -1
  89. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  90. data/docs/doc/PhraseParser/Query.html +1 -1
  91. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  92. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  93. data/docs/doc/PhraseParser/TermClause.html +1 -1
  94. data/docs/doc/PhraseParser.html +1 -1
  95. data/docs/doc/Status.html +1 -1
  96. data/docs/doc/String.html +287 -3155
  97. data/docs/doc/Symbol.html +40 -6
  98. data/docs/doc/Time.html +1 -1
  99. data/docs/doc/TrueClass.html +35 -1
  100. data/docs/doc/_index.html +5 -10
  101. data/docs/doc/class_list.html +1 -1
  102. data/docs/doc/file.README.html +2 -2
  103. data/docs/doc/index.html +2 -2
  104. data/docs/doc/method_list.html +278 -678
  105. data/docs/doc/top-level-namespace.html +2 -2
  106. data/doing.gemspec +1 -0
  107. data/doing.rdoc +297 -206
  108. data/lib/completion/_doing.zsh +32 -32
  109. data/lib/completion/doing.bash +30 -30
  110. data/lib/completion/doing.fish +87 -77
  111. data/lib/doing/array/array.rb +4 -0
  112. data/lib/doing/array/nested_hash.rb +17 -0
  113. data/lib/doing/{array.rb → array/tags.rb} +7 -25
  114. data/lib/doing/changelog/change.rb +26 -11
  115. data/lib/doing/changelog/changes.rb +37 -8
  116. data/lib/doing/changelog/version.rb +11 -3
  117. data/lib/doing/{array_chronify.rb → chronify/array.rb} +0 -0
  118. data/lib/doing/chronify/chronify.rb +5 -0
  119. data/lib/doing/{numeric_chronify.rb → chronify/numeric.rb} +0 -0
  120. data/lib/doing/{string_chronify.rb → chronify/string.rb} +0 -0
  121. data/lib/doing/colors.rb +115 -54
  122. data/lib/doing/completion/zsh_completion.rb +5 -0
  123. data/lib/doing/configuration.rb +9 -5
  124. data/lib/doing/good.rb +8 -0
  125. data/lib/doing/help_monkey_patch.rb +6 -5
  126. data/lib/doing/item.rb +5 -5
  127. data/lib/doing/items.rb +2 -2
  128. data/lib/doing/log_adapter.rb +35 -2
  129. data/lib/doing/normalize.rb +188 -0
  130. data/lib/doing/plugins/export/dayone_export.rb +1 -1
  131. data/lib/doing/plugins/export/html_export.rb +1 -1
  132. data/lib/doing/plugins/export/json_export.rb +1 -1
  133. data/lib/doing/plugins/export/markdown_export.rb +1 -1
  134. data/lib/doing/plugins/export/template_export.rb +3 -1
  135. data/lib/doing/prompt.rb +1 -3
  136. data/lib/doing/section.rb +1 -1
  137. data/lib/doing/string/highlight.rb +95 -0
  138. data/lib/doing/string/query.rb +129 -0
  139. data/lib/doing/string/string.rb +12 -0
  140. data/lib/doing/string/tags.rb +164 -0
  141. data/lib/doing/string/transform.rb +168 -0
  142. data/lib/doing/string/truncate.rb +75 -0
  143. data/lib/doing/string/url.rb +82 -0
  144. data/lib/doing/template_string.rb +0 -22
  145. data/lib/doing/types.rb +8 -0
  146. data/lib/doing/util.rb +13 -9
  147. data/lib/doing/version.rb +1 -1
  148. data/lib/doing/wwid.rb +54 -36
  149. data/lib/doing.rb +5 -6
  150. data/lib/examples/plugins/wiki_export/wiki_export.rb +1 -1
  151. data/lib/helpers/threaded_tests.rb +15 -2
  152. data/scripts/deploy.rb +107 -0
  153. data/scripts/runtests.sh +4 -0
  154. metadata +39 -8
  155. data/lib/doing/string.rb +0 -765
  156. data/lib/doing/symbol.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89acdccf306ca4dc321dc892e5fea91070b002a16f37672791d8d62db2adc640
4
- data.tar.gz: 3380e462bf2744a887192282ea1adfadefec985140aa0a701fd3f60bddc9f8db
3
+ metadata.gz: b897cc1d14bff24b026ccfe6e66861da45d5cab9b842e896c108a80569945790
4
+ data.tar.gz: c90c0ce2ef63b3b6ae0fdf7b8980640b7e4802bef6d9325c95375b7cddc830db
5
5
  SHA512:
6
- metadata.gz: 0ba19a752642d7c974ce5c2c209571f81001453b30c8c4062cac25cb985919bcb0c0e42fbd3cf157e5a40db809f521e96dbdde949725347b33f5b237080ef8d2
7
- data.tar.gz: b446437bc24b5476a052d6370d793828a63f88bf0b04af21e869ccc16c146cbdb88a53220f732471c7a1646e77ca8763c295ee255fe6e2aaaf064213700cacdb
6
+ metadata.gz: 7d895dd6fe2b1c21718f5d627fd7cc6b9d278f318a4cf456d15cd34562a81814048dd3fd570955fdbb9e5ac818b87b6093621e5c9c1c0827c3247d7c14827021
7
+ data.tar.gz: 41c1438c813c34e475ef69f28efa73473e4fbebff63839264000218d60a2e4feca67e37c981eba87840cce43a51bc269e40b84940107c4ba111cc3cb22deda3d
data/.yardoc/checksums CHANGED
@@ -1,34 +1,29 @@
1
- lib/doing/good.rb de4a18a87ac6d316037750944f91f0a3739adafc
1
+ lib/doing/good.rb afeaffc5f1931b2892aa611125da461178ca1def
2
2
  lib/doing/hash.rb 321c27f54f332260c6adced7e451016b79574d38
3
- lib/doing/item.rb 8aec1775784e73fd7181efca4482dac94d466619
3
+ lib/doing/item.rb b5c5cc0d1543b678ee2c4bc10d381e555e318b82
4
4
  lib/doing/note.rb bbadd9e34e6dc43a2af1110a5107f46c39d2547f
5
5
  lib/doing/time.rb 60183c3c31532ffea1440c766de0f90042e0fd10
6
- lib/doing/util.rb 183577d0d9dee966dcf65645b312b17b958e46d6
7
- lib/doing/wwid.rb 1410410c6072cc330baedea27e30a371ec7d3136
8
- lib/doing/array.rb b50c4604cb685dff87bc16bc20f21a5956b2b396
6
+ lib/doing/util.rb 3c5a795dce204584be149e9bbcf1d25f3368e901
7
+ lib/doing/wwid.rb 5e6cd1fa0641a762e17a14c7e0fce09968dbe661
9
8
  lib/doing/hooks.rb 1b75ca731f9e8cb0b7a32785d6e496ee67a70d5c
10
- lib/doing/items.rb 69c762d337d9dad2b780cd08cc1c8785310e23ba
9
+ lib/doing/items.rb dbda21422a06828f221fe462ff159d228b942044
11
10
  lib/doing/pager.rb 7f9d5551c8f5411c3d39b3d984ac7118f98f5da5
12
- lib/doing/types.rb df05c1282d5f6b8efda68c6f289499683a5cc7d1
13
- lib/doing/colors.rb b7239a69e10c5df9378a5843441af5b93c1872f8
11
+ lib/doing/types.rb 6263b1871efa1e8f6053d3bce69ebf678d27324e
12
+ lib/doing/colors.rb 8c2d1c8c7e99022d33f1548c5456a0f02d570c4f
14
13
  lib/doing/errors.rb af07e482a5389924edc2337749c81cda501098f0
15
- lib/doing/prompt.rb eaa388322b1c8190e50882638e70b58010376c8d
16
- lib/doing/string.rb 32fd00cfdfb01a664e194e70ffcad199cd217741
17
- lib/doing/symbol.rb 309799458a1bc715c2707307c9a62ab26086275e
18
- lib/doing/section.rb 206e119cf818f1e76798753e611180fe77bc299a
19
- lib/doing/version.rb a44860dcd8bbb820478d02ef0f8e2378db4a9b15
14
+ lib/doing/prompt.rb 330b8e6e1e85f73b54f602a0aeac58b6b422fabb
15
+ lib/doing/section.rb 48f200cf363a555b51d90d6477939cf3cf83f241
16
+ lib/doing/version.rb bcf0f3a6ad0a8d30d33f1f3f218d59a88ae6a915
20
17
  lib/doing/changelog.rb f7d1bd424e63400ab0613ef3358e614fdf53e2b5
18
+ lib/doing/normalize.rb b9925102db5f19cae0e524ffd1be979ab5bc1199
21
19
  lib/doing/cli_status.rb dbedd454c4cbbd0fed9ef30120f6ec85d18b9356
22
20
  lib/doing/completion.rb c658e7dc7898fb022a21b2bd77bedb958ca3b067
23
- lib/doing/log_adapter.rb 62ee66981878bd7285ccf0dfeca90a3d6d2af985
21
+ lib/doing/log_adapter.rb 1bc8cab3af769a0caa0c64e8ce63c7860a628578
24
22
  lib/doing/util_backup.rb c13f71072581b1f0d2269853611ba09273261bf9
25
- lib/doing/configuration.rb 30c3d9ada7d8e538fcdf725318845ad5310facf6
23
+ lib/doing/configuration.rb 649c0dbe9b3d661e1004a2367ec74fdc673c2e69
26
24
  lib/doing/phrase_parser.rb 8f1789d7cf8326d8cc231b4a21505a93f8de20d2
27
- lib/doing/array_chronify.rb b39b40268b1751b18acf6bae4e53885818e45f62
28
25
  lib/doing/plugin_manager.rb cb16a82c3182ef7008359670ab96ff6b39270ccc
29
- lib/doing/string_chronify.rb 888afa2175f3bb6cac0d68e3cb0f27cf162bb1bf
30
- lib/doing/template_string.rb 3b35970f2a68112192d2bb97c1298b90cf717b3d
31
- lib/doing/numeric_chronify.rb bedeff62a95f8a8ff116e1bf0cc1d9eb2707a900
32
- lib/doing/help_monkey_patch.rb 6aa514c249e519db507ae528de2604c18cc36045
26
+ lib/doing/template_string.rb 5d7c7ac9bdf0d44bc32a0442b2fdd243bd1eee24
27
+ lib/doing/help_monkey_patch.rb bd234939e797f2578c1155985383ef4a279d4d46
33
28
  lib/doing/boolean_term_parser.rb 075977892ac5c6e3435cb8877d8b8b68eb1962e3
34
29
  lib/doing/markdown_document_listener.rb 45485f225068a34951ec818a345f642323e5ba35
data/.yardoc/object_types CHANGED
Binary file
Binary file
data/CHANGELOG.md CHANGED
@@ -1,3 +1,55 @@
1
+ ### 2.1.30
2
+
3
+ 2022-02-16 07:18
4
+
5
+ #### IMPROVED
6
+
7
+ - `doing changes` does a better job of parsing a lookup string like '>= 2.1.10 < 2.1.15'
8
+
9
+ #### FIXED
10
+
11
+ - System agnostic platform detection, so commands that check for Darwin won't error out on other systems
12
+ - `doing completions` debugging code
13
+
14
+ ### 2.1.29
15
+
16
+ 2022-02-14 12:42
17
+
18
+ #### IMPROVED
19
+
20
+ - `doing changes --interactive` will load up a changelog viewer using fzf. Because it makes me happy, that's why.
21
+
22
+ ### 2.1.28
23
+
24
+ 2022-02-14 11:39
25
+
26
+ #### FIXED
27
+
28
+ - Lines merging in `doing changes --changes` output
29
+
30
+ ### 2.1.27
31
+
32
+ 2022-02-14 06:04
33
+
34
+ #### NEW
35
+
36
+ - `doing finish --update` will overwrite any existing @done tag with a new date (current time or set with `--at` or `--back`)
37
+
38
+ #### IMPROVED
39
+
40
+ - Code refactoring and cleanup
41
+ - Include release dates in `doing changes` output when available
42
+ - Allow various naming conventions for %color strings in templates. Now `boldwhite`, `brightwhite`, `bg_bold_cyan`, and `bold_bg_cyan` all work (for example)
43
+ - Common flags (e.g. --search, --tag) found on multiple commands consolidated and help descriptions matched
44
+ - `commands_accepting` now accepts multiple arguments and a `--bool` flag
45
+ - `changes` command can now output changes only (no version numbers) and defaults to raw Markdown if not a TTY or the `--md` flag is used
46
+ - `doing archive` now accepts `--after` and `--from` date filters
47
+
48
+ #### FIXED
49
+
50
+ - Some flag descriptions in help
51
+ - Editor detection
52
+
1
53
  ### 2.1.26
2
54
 
3
55
  2022-01-23 16:14
data/Dockerfile CHANGED
@@ -1,9 +1,9 @@
1
1
  FROM ruby:3.0.1
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
- COPY ./ /doing/
5
+ # COPY ./ /doing/
6
6
  RUN gem install bundler:2.2.17
7
- # RUN bundle update --bundler
8
- RUN bundle install
9
- CMD ["rake", "parallel:test"]
7
+ RUN apt-get update -y
8
+ RUN apt-get install -y less
9
+ CMD ["scripts/runtests.sh"]
data/Dockerfile-2.6 CHANGED
@@ -1,9 +1,9 @@
1
1
  FROM ruby:2.6
2
+ # RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
2
3
  RUN mkdir /doing
3
4
  WORKDIR /doing
4
- COPY ./ /doing/
5
+ # COPY ./ /doing/
5
6
  RUN gem install bundler:2.2.17
6
- # RUN bundle update --bundler
7
- RUN bundle install
8
- # ENTRYPOINT rake parallel:test
9
- CMD ["rake", "parallel:test"]
7
+ RUN apt-get update -y
8
+ RUN apt-get install -y less
9
+ CMD ["scripts/runtests.sh"]
data/Dockerfile-2.7 CHANGED
@@ -1,8 +1,9 @@
1
1
  FROM ruby:2.7
2
+ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
2
3
  RUN mkdir /doing
3
4
  WORKDIR /doing
4
- COPY ./ /doing/
5
+ # COPY ./ /doing/
5
6
  RUN gem install bundler:2.2.17
6
- # RUN bundle update --bundler
7
- RUN bundle install
8
- CMD ["rake", "parallel:test"]
7
+ RUN apt-get update -y
8
+ RUN apt-get install -y less
9
+ CMD ["scripts/runtests.sh"]
data/Dockerfile-3.0 CHANGED
@@ -1,8 +1,9 @@
1
1
  FROM ruby:3.0.0
2
+ # RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
2
3
  RUN mkdir /doing
3
4
  WORKDIR /doing
4
- COPY ./ /doing/
5
+ # COPY ./ /doing/
5
6
  RUN gem install bundler:2.2.17
6
- # RUN bundle update --bundler
7
- RUN bundle install
8
- CMD ["rake", "parallel:test"]
7
+ RUN apt-get update -y
8
+ RUN apt-get install -y less
9
+ 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.26)
4
+ doing (2.1.30)
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,6 +9,7 @@ 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)
12
13
  tty-link (~> 0.1, >= 0.1.1)
13
14
  tty-markdown (~> 0.7, >= 0.7.0)
14
15
  tty-progressbar (~> 0.18, >= 0.18.2)
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.25<!--END VER-->.
11
+ The current version of `doing` is <!--VER-->2.1.29<!--END VER-->.
12
12
 
13
13
  Find all of the documentation in the [doing wiki][wiki].
14
14
 
data/Rakefile CHANGED
@@ -77,15 +77,14 @@ task :dockertest, :version, :login do |_, args|
77
77
  file = 'Dockerfile'
78
78
  end
79
79
 
80
-
81
80
  puts `docker build . --file #{file} -t #{img}`
82
81
 
83
- exec "docker run -it #{img} /bin/bash -l" if args[:login]
82
+ exec "docker run -v #{File.dirname(__FILE__)}:/doing -it #{img} /bin/bash -l" if args[:login]
84
83
 
85
84
  spinner = TTY::Spinner.new('[:spinner] Running tests ...', hide_cursor: true)
86
85
 
87
86
  spinner.auto_spin
88
- res = `docker run --rm -it #{img}`
87
+ res = `docker run --rm -v #{File.dirname(__FILE__)}:/doing -it #{img}`
89
88
  # commit = puts `bash -c "docker commit $(docker ps -a|grep #{img}|awk '{print $1}'|head -n 1) #{img}"`.strip
90
89
  spinner.success
91
90
  spinner.stop
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@add_section
2
4
  desc 'Add a new section to the "doing" file'
3
5
  arg_name 'SECTION_NAME'
@@ -1,11 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@again @@resume
2
4
  desc 'Repeat last entry as new entry'
3
- long_desc 'This command is designed to allow multiple time intervals to be created for an entry by duplicating it with a new start (and end, eventually) time'
5
+ long_desc 'This command is designed to allow multiple time intervals to be created
6
+ for an entry by duplicating it with a new start (and end, eventually) time'
4
7
  command %i[again resume] do |c|
5
- c.example 'doing resume', desc: 'Duplicate the most recent entry with a new start time, removing any @done tag'
6
- c.example 'doing again', desc: 'again is an alias for resume'
7
- c.example 'doing resume --editor', desc: 'Repeat the last entry, opening the new entry in the default editor'
8
- c.example 'doing resume --tag project1 --in Projects', desc: 'Repeat the last entry tagged @project1, creating the new entry in the Projects section'
8
+ c.example 'doing resume',
9
+ desc: 'Duplicate the most recent entry with a new start time, removing any @done tag'
10
+ c.example 'doing again',
11
+ desc: 'again is an alias for resume'
12
+ c.example 'doing resume --editor',
13
+ desc: 'Repeat the last entry, opening the new entry in the default editor'
14
+ c.example 'doing resume --tag project1 --in Projects',
15
+ desc: 'Repeat the last entry tagged @project1, creating the new entry in the Projects section'
9
16
  c.example 'doing resume --interactive', desc: 'Select the entry to repeat from a menu'
10
17
 
11
18
  c.desc 'Get last entry from a specific section'
@@ -16,84 +23,35 @@ command %i[again resume] do |c|
16
23
  c.arg_name 'SECTION_NAME'
17
24
  c.flag [:in]
18
25
 
19
- c.desc 'Backdate start date by interval or set to time [4pm|20m|2h|"yesterday noon"]'
20
- c.arg_name 'DATE_STRING'
21
- c.flag %i[b back started], type: DateBeginString
22
-
23
- c.desc 'Repeat last entry matching tags. Combine multiple tags with a comma. Wildcards allowed (*, ?)'
24
- c.arg_name 'TAG'
25
- c.flag [:tag], type: TagArray
26
-
27
- c.desc 'Repeat last entry matching search. Surround with
28
- slashes for regex (e.g. "/query/"), start with a single quote for exact match ("\'query").'
29
- c.arg_name 'QUERY'
30
- c.flag [:search]
31
-
32
- c.desc 'Perform a tag value query ("@done > two hours ago" or "@progress < 50"). May be used multiple times, combined with --bool'
33
- c.arg_name 'QUERY'
34
- c.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY
35
-
36
- # c.desc '[DEPRECATED] Use alternative fuzzy matching for search string'
37
- # c.switch [:fuzzy], default_value: false, negatable: false
38
-
39
- c.desc 'Force exact search string matching (case sensitive)'
40
- c.switch %i[x exact], default_value: @config.exact_match?, negatable: @config.exact_match?
41
-
42
- c.desc 'Resume items that *don\'t* match search/tag filters'
43
- c.switch [:not], default_value: false, negatable: false
44
-
45
- c.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'
46
- c.arg_name 'TYPE'
47
- c.flag [:case], must_match: /^[csi]/, default_value: @settings.dig('search', 'case')
48
-
49
- c.desc 'Boolean used to combine multiple tags. Use PATTERN to parse + and - as booleans'
50
- c.arg_name 'BOOLEAN'
51
- c.flag [:bool], must_match: REGEX_BOOL, default_value: 'PATTERN'
52
-
53
- c.desc "Edit duplicated entry with #{Doing::Util.default_editor} before adding"
54
- c.switch %i[e editor], negatable: false, default_value: false
55
-
56
- c.desc 'Add a note'
57
- c.arg_name 'TEXT'
58
- c.flag %i[n note]
59
-
60
- c.desc 'Prompt for note via multi-line input'
61
- c.switch %i[ask], negatable: false, default_value: false
62
-
63
26
  c.desc 'Select item to resume from a menu of matching entries'
64
27
  c.switch %i[i interactive], negatable: false, default_value: false
65
28
 
29
+ add_options(:add_entry, c)
30
+ add_options(:search, c)
31
+ add_options(:tag_filter, c)
32
+
66
33
  c.action do |_global_options, options, _args|
67
34
  options[:fuzzy] = false
68
- tags = options[:tag].nil? ? [] : options[:tag]
69
-
70
- options[:case] = options[:case].normalize_case
71
35
 
72
36
  if options[:search]
73
- search = options[:search]
74
- search.sub!(/^'?/, "'") if options[:exact]
75
- options[:search] = search
37
+ options[:search] = options[:exact] ? options[:search].sub(/^'?/, "'") : options[:search]
76
38
  end
77
39
 
78
40
  if options[:back]
79
- date = options[:back]
41
+ options[:date] = options[:back]
80
42
  raise InvalidTimeExpression, 'Unable to parse date string for --back' if date.nil?
43
+
81
44
  else
82
- date = Time.now
45
+ options[:date] = Time.now
83
46
  end
84
47
 
85
48
  note = Doing::Note.new(options[:note])
86
49
  note.add(Doing::Prompt.read_lines(prompt: 'Add a note')) if options[:ask]
87
50
 
88
51
  options[:note] = note
52
+ options[:tag] ||= []
53
+ options[:tag_bool] = options[:bool]
89
54
 
90
- opts = options.clone
91
-
92
- opts[:tag] = tags
93
- opts[:tag_bool] = options[:bool].normalize_bool
94
- opts[:interactive] = options[:interactive]
95
- opts[:date] = date
96
-
97
- @wwid.repeat_last(opts)
55
+ @wwid.repeat_last(options)
98
56
  end
99
57
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@archive @@move
2
4
  desc 'Move entries between sections'
3
5
  long_desc %(Argument can be a section name to move all entries from a section,
@@ -10,7 +12,8 @@ command %i[archive move] do |c|
10
12
  c.example 'doing archive Currently', desc: 'Move all entries in the Currently section to Archive section'
11
13
  c.example 'doing archive @done', desc: 'Move all entries tagged @done to Archive'
12
14
  c.example 'doing archive --to Later @project1', desc: 'Move all entries tagged @project1 to Later section'
13
- c.example 'doing move Later --tag project1 --to Currently', desc: 'Move entries in Later tagged @project1 to Currently (move is an alias for archive)'
15
+ c.example 'doing move Later --tag project1 --to Currently',
16
+ desc: 'Move entries in Later tagged @project1 to Currently (move is an alias for archive)'
14
17
 
15
18
  c.desc 'How many items to keep (ignored if archiving by tag or search)'
16
19
  c.arg_name 'X'
@@ -23,74 +26,30 @@ command %i[archive move] do |c|
23
26
  c.desc 'Label moved items with @from(SECTION_NAME)'
24
27
  c.switch [:label], default_value: true, negatable: true
25
28
 
26
- c.desc 'Tag filter, combine multiple tags with a comma. Wildcards allowed (*, ?). Added for compatibility with other commands'
27
- c.arg_name 'TAG'
28
- c.flag [:tag], type: TagArray
29
-
30
- c.desc 'Tag boolean (AND|OR|NOT). Use PATTERN to parse + and - as booleans'
31
- c.arg_name 'BOOLEAN'
32
- c.flag [:bool], must_match: REGEX_BOOL, default_value: 'PATTERN'
33
-
34
- c.desc 'Search filter'
35
- c.arg_name 'QUERY'
36
- c.flag [:search]
37
-
38
- c.desc 'Perform a tag value query ("@done > two hours ago" or "@progress < 50"). May be used multiple times, combined with --bool'
39
- c.arg_name 'QUERY'
40
- c.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY
41
-
42
- # c.desc '[DEPRECATED] Use alternative fuzzy matching for search string'
43
- # c.switch [:fuzzy], default_value: false, negatable: false
44
-
45
- c.desc 'Force exact search string matching (case sensitive)'
46
- c.switch %i[x exact], default_value: @config.exact_match?, negatable: @config.exact_match?
47
-
48
- c.desc 'Show items that *don\'t* match search string'
49
- c.switch [:not], default_value: false, negatable: false
50
-
51
- c.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'
52
- c.arg_name 'TYPE'
53
- c.flag [:case], must_match: /^[csi]/, default_value: @settings.dig('search', 'case')
54
-
55
- c.desc 'Archive entries older than date
56
- (Flexible date format, e.g. 1/27/2021, 2020-07-19, or Monday 3pm)'
57
- c.arg_name 'DATE_STRING'
58
- c.flag [:before], type: DateEndString
29
+ add_options(:search, c)
30
+ add_options(:tag_filter, c)
31
+ add_options(:date_filter, c)
59
32
 
60
33
  c.action do |_global_options, options, args|
61
34
  options[:fuzzy] = false
62
- if args.empty?
63
- section = @settings['current_section']
64
- tags = []
65
- elsif args[0] =~ /^all/i
66
- section = 'all'
67
- elsif args[0] =~ /^@\S+/
68
- section = 'all'
69
- tags = args.map { |t| t.sub(/^@/, '').strip }
70
- else
71
- section = args[0].cap_first
72
- tags = args.length > 1 ? args[1..].map { |t| t.sub(/^@/, '').strip } : []
73
- end
35
+ section, tags = if args.empty?
36
+ [@settings['current_section'], []]
37
+ elsif args[0] =~ /^all/i
38
+ ['all', []]
39
+ elsif args[0] =~ /^@\S+/
40
+ ['all', args.tags_to_array]
41
+ else
42
+ [args.shift.cap_first, args.tags_to_array]
43
+ end
74
44
 
75
45
  raise InvalidArgument, '--keep and --count can not be used together' if options[:keep] && options[:count]
76
46
 
77
47
  tags.concat(options[:tag]) if options[:tag]
78
48
 
79
- search = nil
80
-
81
- options[:case] = options[:case].normalize_case
82
-
83
- if options[:search]
84
- search = options[:search]
85
- search.sub!(/^'?/, "'") if options[:exact]
86
- end
87
-
88
- opts = options.clone
89
- opts[:search] = search
90
- opts[:bool] = options[:bool].normalize_bool
91
- opts[:destination] = options[:to]
92
- opts[:tags] = tags
49
+ options[:search] = options[:search].sub(/^'?/, "'") if options[:search] && options[:exact]
50
+ options[:destination] = options[:to]
51
+ options[:tags] = tags
93
52
 
94
- @wwid.archive(section, opts)
53
+ @wwid.archive(section, options)
95
54
  end
96
55
  end
@@ -1,6 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@cancel
2
4
  desc 'End last X entries with no time tracked'
3
- long_desc 'Adds @done tag without datestamp so no elapsed time is recorded. Alias for `doing finish --no-date`'
5
+ long_desc 'Adds @done tag without datestamp so no elapsed time is recorded.
6
+ Alias for `doing finish --no-date`'
4
7
  arg_name 'COUNT'
5
8
  command :cancel do |c|
6
9
  c.example 'doing cancel', desc: 'Cancel the last entry'
@@ -13,90 +16,45 @@ command :cancel do |c|
13
16
  c.arg_name 'NAME'
14
17
  c.flag %i[s section]
15
18
 
16
- c.desc 'Cancel the last X entries containing TAG. Separate multiple tags with comma (--tag=tag1,tag2). Wildcards allowed (*, ?)'
17
- c.arg_name 'TAG'
18
- c.flag [:tag], type: TagArray
19
-
20
- c.desc 'Boolean (AND|OR|NOT) with which to combine multiple tag filters. Use PATTERN to parse + and - as booleans'
21
- c.arg_name 'BOOLEAN'
22
- c.flag [:bool], must_match: REGEX_BOOL, default_value: 'PATTERN'
23
-
24
- c.desc 'Cancel the last X entries matching search filter, surround with slashes for regex (e.g. "/query.*/"), start with single quote for exact match ("\'query")'
25
- c.arg_name 'QUERY'
26
- c.flag [:search]
27
-
28
- c.desc 'Perform a tag value query ("@done > two hours ago" or "@progress < 50"). May be used multiple times, combined with --bool'
29
- c.arg_name 'QUERY'
30
- c.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY
31
-
32
- # c.desc '[DEPRECATED] Use alternative fuzzy matching for search string'
33
- # c.switch [:fuzzy], default_value: false, negatable: false
34
-
35
- c.desc 'Force exact search string matching (case sensitive)'
36
- c.switch %i[x exact], default_value: @config.exact_match?, negatable: @config.exact_match?
37
-
38
- c.desc 'Finish items that *don\'t* match search/tag filters'
39
- c.switch [:not], default_value: false, negatable: false
40
-
41
- c.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'
42
- c.arg_name 'TYPE'
43
- c.flag [:case], must_match: /^[csi]/, default_value: @settings.dig('search', 'case')
44
-
45
19
  c.desc 'Cancel last entry (or entries) not already marked @done'
46
20
  c.switch %i[u unfinished], negatable: false, default_value: false
47
21
 
48
22
  c.desc 'Select item(s) to cancel from a menu of matching entries'
49
23
  c.switch %i[i interactive], negatable: false, default_value: false
50
24
 
25
+ add_options(:search, c)
26
+ add_options(:tag_filter, c)
27
+
51
28
  c.action do |_global_options, options, args|
52
29
  options[:fuzzy] = false
53
- if options[:section]
54
- section = @wwid.guess_section(options[:section]) || options[:section].cap_first
55
- else
56
- section = @settings['current_section']
57
- end
58
-
59
- if options[:tag].nil?
60
- tags = []
61
- else
62
- tags = options[:tag]
63
- end
30
+ options[:section] = if options[:section]
31
+ @wwid.guess_section(options[:section]) || options[:section].cap_first
32
+ else
33
+ @settings['current_section']
34
+ end
64
35
 
65
36
  raise InvalidArgument, 'Only one argument allowed' if args.length > 1
66
37
 
67
- raise InvalidArgument, 'Invalid argument (specify number of recent items to mark @done)' unless args.empty? || args[0] =~ /\d+/
38
+ unless args.empty? || args[0] =~ /\d+/
39
+ raise InvalidArgument, 'Invalid argument (specify number of recent items to mark @done)'
68
40
 
69
- if options[:interactive]
70
- count = 0
71
- else
72
- count = args[0] ? args[0].to_i : 1
73
41
  end
74
42
 
75
- search = nil
43
+ options[:count] = if options[:interactive]
44
+ 0
45
+ else
46
+ args[0] ? args[0].to_i : 1
47
+ end
76
48
 
77
- if options[:search]
78
- search = options[:search]
79
- search.sub!(/^'?/, "'") if options[:exact]
80
- end
49
+ options[:search] = options[:search].sub(/^'?/, "'") if options[:search] && options[:exact]
81
50
 
82
- opts = {
83
- archive: options[:archive],
84
- case: options[:case].normalize_case,
85
- count: count,
86
- date: false,
87
- fuzzy: options[:fuzzy],
88
- interactive: options[:interactive],
89
- not: options[:not],
90
- search: search,
91
- section: section,
92
- sequential: false,
93
- tag: tags,
94
- tag_bool: options[:bool].normalize_bool,
95
- tags: ['done'],
96
- unfinished: options[:unfinished],
97
- val: options[:val]
98
- }
51
+ options[:case] = options[:case].normalize_case
52
+ options[:date] = false
53
+ options[:sequential] = false
54
+ options[:tag] ||= []
55
+ options[:tag_bool] = options[:bool].normalize_bool
56
+ options[:tags] = ['done']
99
57
 
100
- @wwid.tag_last(opts)
58
+ @wwid.tag_last(options)
101
59
  end
102
60
  end